This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-15
Channels
- # architecture (2)
- # beginners (16)
- # boot (2)
- # cider (4)
- # clara (6)
- # cljs-dev (78)
- # cljsrn (3)
- # clojure (158)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-dusseldorf (19)
- # clojure-italy (8)
- # clojure-russia (3)
- # clojure-spec (77)
- # clojure-uk (61)
- # clojurescript (341)
- # cursive (9)
- # data-science (12)
- # datomic (18)
- # emacs (9)
- # fulcro (109)
- # hoplon (10)
- # juxt (2)
- # leiningen (2)
- # lumo (31)
- # off-topic (1)
- # om (4)
- # onyx (40)
- # parinfer (17)
- # re-frame (36)
- # reagent (19)
- # spacemacs (10)
- # vim (60)
- # yada (20)
Hmm, I'm getting the error still - I think I need to do some more digging before I have an answer. Thanks for your help! 🙂
Actually, it looks like your fix worked! 😄
Yeah, looks like I was evaluating the old file when I applied your workaround. Is there somewhere to look into how tools.reader
parses/outputs regexes?
Yeah, I tried evaluating my regex in a Clojure REPL:
(require '[clojure.tools.reader.edn :as edn])
(edn/read-string "#\".+@.+\..+\"")
I may not be escaping the string correctly, but it produces this error:
java.lang.RuntimeException: Unsupported escape character: \.
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unsupported escape character: \.
java.lang.RuntimeException: Unable to resolve symbol: .+ in this context
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: .+ in this context, compiling:(<truncaed>.clj)
java.lang.RuntimeException: EOF while reading string
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading string
Ah, right
I get a much shorter error 😛 clojure.lang.ExceptionInfo: Unsupported escape character: \..
@lambdahands The reader appears to be able to read it:
user=> (require '[clojure.tools.reader :as r])
nil
user=> (r/read-string "#\".+@.+\\..+\"")
#".+@.+\..+"
I think ClojureScript uses the EDN reader though: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/reader.cljs#L142
@lambdahands edn has no support for regexes
are any follow-up (maintenance) releases for 1.9.854 expected any time soon?
Hm, is there a known limitation requirement for using npm modules? It either works perfectly, or the :require goes down ni flames. e.g. jsdom 11.1.0 can't be resolved by the compiler despite a successful installation in node_modules.
@thheller I got the above error and shadow-cljs (yarn version) failed to start
@boyanb it’s an alpha quality feature, so lots of things aren’t going to work - these cases are getting sorted through slowly
@dragoncube yes today
Cool, is there an expectation to fill in reports on this so you can investigate, or should we just assume taht the feature is getting ironed out and no use in reporting?
if you want to dig into what’s going wrong so we get something specific to look at, that’s preferred
Alright, I can quickly wrap up a reproducable and will look at the generated google compiler deps, but I'm unsure if I will get far. I already noticed that the dep itself defines exports in a non clear way (no single export).
if the library dynamically generates exports you’re likely out of luck - I would file a report to the JS library
Alright, I'll be in touch if I have a concrete issue on cljs side. Still, awesome work on this feature, keep it up.
I’m not doing so much on it actually 🙂 Thank @anmonteiro and @juhoteperi and others
Hello. I'm trying to realize what the problem with custom data readers. Here is my minimal case: https://github.com/prepor/cljs-data-readers (https://github.com/prepor/cljs-data-readers/blob/master/src/dr/core.cljs#L6)
(.log js/console (type #dr/pos {:line 1 :col 3}))
It prints PersistentArrayMap
. Unsurprised, because it generates code like
console.log(cljs.core.type.call(null,new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"line","line",212345235),(1),new cljs.core.Keyword(null,"col","col",-1959363084),(3)], null)));
Looks like, if I return records from data reader it compiles it as a plain map, not record.@prepor the code makes no sense to me, I believe custom data readers can be specified when you are doing your own reading, I’m not aware that you could customize clojurescript’s own reader to include your custom data readers when parsing your source code
@prepor safe yourself alot of headaches and just write (dr/pos {:line 1 :col 3})
without reader tags
we made the necessary changes so that custom reader code can be applied at compile/runtime
ie. https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L324-L331
@dnolen this sounds like an “inception” situation to me 🙂 my understanding: in non-selfhosted mode, cljs compiler uses reader implemented in clojure and to customize it you would need to write some clojure code (which would run as a macro at compile time before cljs compiler tries to read actual cljs sources of the project including custom data readers)
@thheller oh maybe that’s true, that should be easy to fix, there’s no need to go through that for registered tags
@prepor’s code was all cljs, without anything remotely resembling reader/read-string or other dynamic reading
Hey guys! I was wondering if anyone knows of sth like Facebook's Dataloader (https://github.com/facebook/dataloader) written in Clojure
@dnolen is this minimal enough? ) https://github.com/prepor/cljs-data-readers2
hrm but actually it should just work if you have data_readers.cljc
so we’ll just have to see
does anyone know if https://github.com/mhallin/forest is still be actively developed
I just hit a strange bug that I can't explain...
I got the error Could not find artifact cljsjs:firebase:jar:3.2.1-0 in central (
This is in a new project, where I added a dependency on [degree9/firebase-cljs "1.3.0"]
in my project.clj.
firebase-cljs, in turn, has a dependency on [cljsjs/firebase "3.2.1-0"]
. (if relevant, it uses boot, while my project uses lein)
The cljsjs dependency was properly installed into my ~/,m2, but then I got the error above.
I worked around the problem by adding an explicit dependeny on the cljsjs project from my project.
So, I'm not stuck for now. But, very puzzled about what went wrong here.
@tony.kay your EDN file from yesterday is pretty unweildy, can you please resend with source mapping disabled?
@dnolen FWIW you now only fixed the special case for records. it still relies on the special behavior for other types (eg. #inst
, deftype
, etc)
which is treated as a constant, which is then emitted as JS code via cljs.compiler/emit-constant
https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L324-L331
Yeah, I thought so as well, but thought you might have had an idea for using magic code on it 😉
:modules {:entry-point {:output-to "resources/public/js/demos/demos.js"
:entries #{cards.card-ui}}
:main {:output-to "resources/public/js/demos/main-ui.js"
:entries #{recipes.dynamic-ui-main}}}
Repeating msg that scrolled off earlier; sorry if this is spammy, but I'm puzzled by this:
I just hit a strange bug that I can't explain...
I got the error Could not find artifact cljsjs:firebase:jar:3.2.1-0 in central (
This is in a new project, where I added a dependency on [degree9/firebase-cljs "1.3.0"]
in my project.clj.
firebase-cljs, in turn, has a dependency on [cljsjs/firebase "3.2.1-0"]
. (if relevant, it uses boot, while my project uses lein)
The cljsjs dependency was properly installed into my ~/,m2, but then I got the error above.
I worked around the problem by adding an explicit dependeny on the cljsjs project from my project.
So, I'm not stuck for now. But, very puzzled about what went wrong here.
@deg My guess is that the dep you’re using lists firebase as “provided” so you can choose your own version
I'm not fluent in boot, but I don't think that's it: https://github.com/degree9/firebase-cljs/blob/master/dependencies.edn
this really isn’t a cljs problem, per-se. More of a tooling issue. If you’re using lein, some possibilities might have to do with things in your user profile, configuration of remote repositories, etc. The error tends to make me think something about your build environment told it to only look in maven (not also in clojars), and perhaps it is only in clojars…that kind of thing. Just making possibilities up. The clojurescript compiler and language are not involved in that step.
Makes sense. But, I've never seen this on any other dependency. Not really sure how much I should worry about it... one line worked around the problem. But, still...
What's especially weird is that half the tooling worked. It did download to my local ~/.m2. But, then, it thought it had not found it.
Yeah, running out of ideas. Network glitch? Something wrong with your local download (perhaps it was partial and things got confused)…
Also look at the pom file from cljsjs firebase. It is just XML…see if it looks messed up. Perhaps the publisher of it got something wrong.
Yeah, running out of ideas. Network glitch? Something wrong with your local download (perhaps it was partial and things got confused)…
Nope, repeated tries, including changing the dependendy in degree9 to different versions of the cljsjs file. The problem was consistent.
I'm cleaning it up now to commit to github, and will post the question on #leinengen in a few minutes,
Also look at the pom file from cljsjs firebase. It is just XML…see if it looks messed up. Perhaps the publisher of it got something wrong.
ah, so perhaps I need to do something to better specify what the actual entry point is supposed to be?
card-ui requires dynamic-ui-routing which requires fulcro.client.routing which requires cljs.loader and issues the load (on user event). The startup code on dynamic-ui-routing does set-loaded on :entry-point dynamic-ui-main requires loader itself and does set-loaded for :main
but that does change the dep graph because then I directly place dynamic-ui-routing in entry-point instead of the transitive from card-ui
OK, first: cards.dynamic_routing_cards
(which is in this list) requires recipes.dynamic-ui-routing
which requires cljs.loader
AND fulcro.client.routing
(which in turn also requires cljs.loader
).
would love to. I’m pretty jazzed about these simplifications, so anything I can do to help
@deg I am more than willing to fix the degree9/firebase-cljs if you figure out the issue
@deg So the error about cljsjs/firebase
not being available on Maven repo is normal, because cljsjs packages are only available from Clojars. Do you also see message about the artifact not being available from Clojars?
@flyboarder The firebase-cljs
pom.xml file is created by boot-semver instead of Boot built-in task? Maybe it does something different.
@flyboarder @juhoteperi I only saw the error message I copied, about Maven.
@deg Do you change :repositories
value in your project?
I don't think it is an env problem here, but easiest way to test would be if you could try my project. (github link is above). Remove the commented dependency line in project.clj, and see it it also fails for you.
@deg Works for me
Yes, removed the line
My ~/.lein/profiles.clj is pretty vanilla:
{:user {:plugins
[;;
[jonase/eastwood "0.2.4"]
;;
[lein-ancient "0.6.10"]
;; Graphical presentation of project dependencies tree
;; See
[walmartlabs/vizdeps "0.1.6"]
]}}
@deg I'm not sure what is the best way to check repositories in lein, but you can run lein pom
and check that <repositories>
in the created pom.xml file includes clojars
I'm having trouble reproducing the problem now. lein clean; lein figwheel dev
was not enough. Will clear .m2 too in a minute.
Unless you think this is likely to be real, and have any tips for me to reproduce it, we may just have to credit this one to the flying spaghetti monster, and forget about it until it happens again. Damn, I hate these.
@juhoteperi @flyboarder I've managed to reproduce it. It does not happen with lein figwheel dev
from a terminal, but does seem to happen in Emacs( (Cider) with C-c C-M-j from the a .cljs buffer.
I just did a small tool that converts TypeScript definitions into Closure Compiler externs, so compiling in advanced mode shouldn’t be problem & manual work. https://github.com/honzabrecka/ts-to-goog
@dpsutton - Here's the whole flow, captured from Emacs *Messages*
buffer: https://gist.github.com/deg/651b7b37ae5943b341e7868fc92590bf
@honzabrecka Interesting! I've been thinking about this but I didn't know about tsickle.
don't know. was wondering if cider was trying to eval cljs in a clj repl, which i've seen a bit
I dunno. Debugging that is way above my Cider-fu. I guess I should move this over to #cider??
I'm extremely confused by some of the behavior of numeric cljs strings. In particular, can anyone clue me in on what's going on here? Why is a string var behaving so differently from a string literal?
cljs.user> (def num-str "-1")
#'cljs.user/num-str
cljs.user> (type num-str)
#object[String "function String() { [native code] }"]
cljs.user> (neg? num-str)
true
cljs.user> (type "-1")
#object[String "function String() { [native code] }"]
cljs.user> (neg? "-1")
---- Compiler Warning on <cljs form> line:1 column:1 ----
cljs.core/<, all arguments must be numbers, got [string number] instead.
1 (neg? "-1")
^---
Actually, could one of you try this in emacs, and see if you can reproduce it first? You need to:
- Remove the dependency from project.clj
- lein clean
- rm ~/.m2/repository/cljsjs/firebase/
- Open emacs buffer on src/cljs/trilystro/events.cljs
- C-c M-J
@eggsyntax because in the second case we can statically infer the type of the argument
@anmonteiro -- OK, I can see that. The second-level weirdness is that the result from (neg? num-str)
isn't just an artifact of neg?
-- both neg?
and pos?
successfully and consistently distinguish negative and positive number strings.
There seems to be some sort of implicit casting going on? Which I'm not used to seeing in clj/s.
yeah, it’s a platform thing
in JS:
"-1" < 0
true
https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/core.cljc#L1143
That totally clears it up. Thanks @anmonteiro !
@dpsutton @flyboarder @juhoteperi It's getting late here, and I need to sleep, and will be OoO tomorrow morning. I will report this on #cider afterwards. If one of you has time/tools meanwhile, much appreciated if you could try to reproduce too. Leave me a note here and I'll see it tomorrow. Thanks!
Beginner, looking for some help on how to communicate between cljs and electron. Let me know if I've posted this in the wrong place and I will delete / move it.
I'm trying to get my clojurescript front end (re-frame) communicating with the electron node back end using the ipcRenderer
. Problem is, I don't know the language well enough to know how to do so.
The function in question:
ipcRenderer.on(channel<string>, listener<function>)
what I have
(Electron.ipcRenderer.send "asynchronous-message" "this is from cljs!") ;; this works -> sends message to electron backend
(Electron.ipcRenderer.on "asynchronous-reply" (fn [event message] ;; this does not
(println event message)))
error I'm getting:
Uncaught TypeError: Cannot read property '_events' of null
at _addListener (events.js:218)
at addListener (events.js:276)
at views.cljs?rel=1502829316642:11
thanks for any help you can afford, folks!I think the “1.9” correlates with clj, but then after that I don’t know what the number is
also, there appear to be even more versions that aren’t listed on the “changes” in GitHub, so I am just tryign to understand the pattern
I was asking for suggestions for a good, free hosting service for Clojure/Clojurescript apps here the other day. A couple of peeps suggested Heroku, so I gave it a go. Having trouble with it now, so I'm just going to ask here again, since those people seemed helpful about the topic, even if it's not #clojurescript per se
@reefersleep what's up?
@mikerod the number after the 1.9 is the number of commits to master after 1.9 was cut
currently there have been 904 commits after r1.9.0
which is why the current version would be 1.9.904 or something
a number of other Cognitect projects follow the same semantics
e.g. transit, core.async
@anmonteiro thanks, it makes sense now. I’ve seen that pattern before I suppose. Just didn’t remember.
on git push heroku master
, I get a long log of build actions from heroku, ending with
remote: minifying assets...
remote: Uberjar aborting because jar failed: /tmp/build_fe99283cdffe2c3578915edab91ec15b/resources/public/css/site.css (No such file or directory)
remote: ! Failed to build.
remote: ! Push rejected, failed to compile Clojure (Leiningen 2) app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to kingdomizer.
remote:
To
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''
but lein uberjar
seems succesful locally
@reefersleep is public/css/site.css
checked into Git, or is it generated during the build?
@codefinger it's generated during build, it seems
(I just transplanted my frontend code into a new lein template in order to make it more easily Heroku-deployable)
@reefersleep does it require node.js runtime by any chance? or does it all run in the JVM?
weeeeeell, there's no mention of it in the project.clj
it's based off of reagent-template
so from what I'm seeing, no node, only JVM
@dnolen hm. I just was doing that. I still see breakage on :simple
. It is possible it is on my end though. I’ll do some more homework and see what I can convince myself of.
@tony.kay well if you have something more specific than “breakage” then I can look at it
@reefersleep k. and locally you run lein uberjar
, and nothing else. or was the site.css
maybe generate in some command you ran earlier?
just lein uberjar
At the moment I get these two console errors when loading: “c is undefined” and “goog is undefined”
@codefinger er, @reefersleep The reagent template seems to contain site.css
literally
yeah, like I said, I have to do more homework before I have something useful I think
@the-kenny cheers, seems I'm a bit confused. I wasn't interested in all of that boilerplate, really, just wanted to deploy my app! 🙂
wouldn’t be an externs problem if you’re doing simple compilation
i'm not following 😞 @reefersleep can i see your code? if it's private, I work at heroku so if you open a ticket at https://help.heroku.com i can peek at it.
well, my repo is here: https://github.com/Reefersleep/kingdomizer . Don't know where that site.css
file went off to.
(and it's not that I haven't pushed it, it's not there locally, either)
maybe I've just removed that folder, somehow. It would explain my error message.
@reefersleep oh, what version of lein you run locally?
2.6.1
@dnolen :whitespace
fails for me too….oh, on my trivial cases, it all worked, even the last build you had
seems like a lein new reagent appname
creates a resources
folder
ah wait. for some reason, the .gitignore contains the resources
folder, which is present locally.
let me just see if an amendment of that helps my Heroku issue...
@reefersleep yea, I got the same (No such file or directory)
when uberjarring locally
weird!
/resources/public/css
is in .gitignore
, which might be right if the css is generated during the build. but otherwise, you might want to check it into Git
just did
trying git heroku push master
again now... Success!
thanks a lot, @codefinger !
@reefersleep awesome
So it seems like this is an error with reagent-template
(unless I somehow botched things up during my frontend code transplant) wherein having the /resources/public/css
folder in the .gitignore
file just prevents a proper Heroku deploy during the build process. I guess I should mention this to the maintainer, @yogthos
Thanks again for your time, @codefinger , especially since I wasted it by fumbling through my own project 😞 😕 🙂
@yogthos I'll do a PR tomorrow! Bedtime here 😴
Great 😄👍
hi! let's say I have an ratom that contains a vector, but the place where I'd like to use it requires the vector in a modified form (I need to run "map" on it). Is there some way to create an ratom from anoter ratom in a way that you can put a transformation in between?
I think you might be looking for a reaction, @U4AH3T9QA
reagent.ratom/reaction
https://reagent-project.github.io/news/news060-alpha.html never found good docs for it, this is as close as it gets, I think
Basically, it's something like
(let [readonly-reaction (reagent.ratom/reaction (process-the-contents-of (:whatever-path-into @my-state-atom)))]
[:div @readonly-reaction]))
The reaction is not swap!
apple or reset!
able, like an atom. You can only deref it
but you can do whatever processing you want 🙂
It'll do that whenever the part of your atom it cares about changes.
You know, reactively 🙂
@yogthos I'll do a PR tomorrow! Bedtime here 😴