-
Notifications
You must be signed in to change notification settings - Fork 67
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
Namespace a.core$macros
causes planck to break
#543
Comments
a.b$macros
causes planck to breaka.core$macros
causes planck to break
It is actually a more generic issue:
|
As far as I can tell, this appears to be rooted in a Closure compiler error related to the application of simple optimizations to It is not yet clear to me how the optimized code fails in the case of Here is the optimized version of
And here is the unoptimized version you get if you build Planck without these optimizations:
|
@anmonteiro Is onto an idea. This only fails for |
Yeah, when you start up Planck, you will see some global variables have already been defined:
|
The root cause is that the locals here (along with the let local) Without optimization, you can see that We end up having a problem with |
Just wanted to chime in that it's very interesting seeing you debug and explain the problem. I learned a lot about planck from this. |
Why is it fixed by a binding? (defn- non-shadowing-js-eval
[]
(js/eval *source*))
(binding [*source* source]
(non-shadowing-js-eval) |
@jiyinyiyong It is not the use of binding, but the eliminating of locals (function arguments and The root problem is that the locals shadow any JavaScript symbols passed to
This is a little tricky to understand, but when you make the call So the solution I went with is the kludge of making the call to |
Which means in the previous version: (defn- js-eval
[source source-url]
#_(when (:verbose @app-env)
(println-verbose (str "Evaluating JavaScript:\n" source)))
(if source-url
(let [exception (js/PLANCK_EVAL source source-url)]
(when exception
(throw exception)))
(js/eval source))) there are variables (defn- non-shadowing-js-eval
[]
(js/eval *source*)) no local variables so no |
@jiyinyiyong The execution environment for Planck is JavaScriptCore. |
Note that with #554, this issue is being solved in a simpler way, relying on an ECMAScript 5 feature, calling In terms of ClojureScript code compare:
to
(The 2nd indirect variant doesn't see the |
So is I wonder if we should label each others issues as |
Credit to @jiyinyiyong for discovering this. anmonteiro/lumo#301 (comment)
The text was updated successfully, but these errors were encountered: