But even that, it only works if you have your string you want to create a Var from at compile time. If you wanted to say have the user type in a string at run-time and create a var from it. I’m not sure you can do that with ClojureScript macros.
Self hosted ClojureScript bundles the compiler with it, so you can’t reify Vars, but you can recompile the code itself and reload it.
At least that’s my understanding.
Vars in ClojureScript are just JS Vars, and I think namespaces are some kind of Goog.Closure nested JS object set.
The funny thing is, you can use
set! it seems, and it’ll create a JS var that resolves, but it’ll keep warning that it is undeclared, since I’m guessing it doesn’t get added to some map of bindings.
> (set! foo 10)
WARNING: Use of undeclared Var cljs.user/foo at line 1
That doesn’t help either since
set! also takes in a Symbol and is a special form so you can’t evaluate its args.