-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
log! doesn't compile inside clojurescript go block #21
Comments
@aiba Hi Aaron, thanks for the report! I'll need to investigate what What's the urgency on this? Could a fix wait till next week sometime? |
Not urgent. For now, I can just wrap log! in a regular function, since go macros don't analyze across function boundaries. |
Okay, thanks! BTW in case it's not obvious, you may literally be able to do something like I'll keep this open till I've investigated and found a solution 👍 |
Problem: (clojure.core.async/go (taoensso.telemere/log! "hello")) ; Compiles fine (cljs.core.async/go (taoensso.telemere/log! "hello")) ; Compile fails I could try to get to the bottom of exactly what's going on - but ultimately IOC mechanisms like `go` are always going to be a bit fragile, especially for heavily-optimized/unusual code. In this case, the problem is thankfully only with Cljs - and Telemere's Cljs performance isn't too critical - so I think we can afford to just bypass any potential fiddling by the `go` macro by wrapping Cljs Telemere expansions in an IIFE ((fn [] ...)). Downside is the (small) added cost of a function construction and call. Upside is avoiding potential issues with core.async and other similar IOC-style systems (Electric Clojure, etc.)
Update: fix (a reasonable workaround) is up on master, and available now as a 1.0.0-SNAPSHOT. Basically just auto-wrapping Cljs expansions with Will keep this issue open until beta 23 is released (ETA next week). |
Oh wow that's a nifty trick I hadn't thought of for go blocks, thank you for that! That's going to be useful to have in many situations. |
Problem: (clojure.core.async/go (taoensso.telemere/log! "hello")) ; Compiles fine (cljs.core.async/go (taoensso.telemere/log! "hello")) ; Compile fails I could try to get to the bottom of exactly what's going on - but ultimately IOC mechanisms like `go` are always going to be a bit fragile, especially for heavily-optimized/unusual code. In this case, the problem is thankfully only with Cljs - and Telemere's Cljs performance isn't too critical - so I think we can afford to just bypass any potential fiddling by the `go` macro by wrapping Cljs Telemere expansions in an IIFE ((fn [] ...)). Downside is the (small) added cost of a function construction and call. Upside is avoiding potential issues with core.async and other similar IOC-style systems (Electric Clojure, etc.)
Closing since this is now addressed in the latest betas 👍 |
Compiling this code in ClojureScript fails with
"ExceptionInfo Can't call nil"
:I'm guessing this has something to do with the way the
log!
macro expands and then thego
macro analyzes the expanded code.On JVM clojure, it works fine. Is there a way to get it to also work in ClojureScript?
The text was updated successfully, but these errors were encountered: