-
Notifications
You must be signed in to change notification settings - Fork 2
Script parameters lead to unbound system variables in Clojure #5
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
Comments
The following script works: #@String myName
(println "hello world") So the problem is specifically having a parameter called Note the following warning which is emitted to the console for your first script:
The issue is not that the clojure interpreter is receiving rogue I started trying to debug by writing a Groovy script (it was an excuse to name a file #@ScriptService scriptService
// NB: \n avoids #@ parameter harvesting in the containing script.
script = """
\n#@String myName
(println "hello world")
"""
lang = scriptService.getLanguageByName("clojure")
println("clojure language = $lang")
engine = lang.getScriptEngine()
println("clojure engine = $engine")
//engine.put("myName", "Curtis")
engine.put("name, "Curtis")
//NB: Asking for the Bindings and putting there instead has the same effect:
//bindings = engine.getBindings(javax.script.ScriptContext.ENGINE_SCOPE)
//bindings.put("myName", "Curtis")
//bindings.put("name", "Curtis")
result = engine.eval(script)
println("result = " + result) I was hoping to see that injecting such a variable directly into the bindings would have the same problem as the one above, but actually in that case I have different problems:
Or with
I haven't looked at this code since last October (see commit history), so I basically completely forgot how anything works. And it is after midnight now, so I think I'll continue investigations some other day. |
This Clojure script works:
This Clojure script works:
This Clojure script does not work:
Throwing the following error:
Note that Clojure's
println
works by binding System.out to*out*
, and#
indicates the beginning of a reader macro in Clojure. The suspicion is that the#
is slipping through and messing with the establishment of theuser
namespace in Clojure.The text was updated successfully, but these errors were encountered: