based on the explanation mfikes gave, the solution I ended up with is 

(js/eval "globalEval = eval")
then in my clojurescript,
(js/globalEval " function abc(){}")

On Tuesday, January 9, 2018 at 1:32:57 AM UTC+2, Sonny To wrote:
>
> clojuresript repl:
> stigmergy.loader> (js/eval "function abc(){}")
> nil
> stigmergy.loader> (js/abc)
> #object[ReferenceError ReferenceError: abc is not defined]                
>                                                                             
>                           
> nil
>
> javascript repl:
> eval("function abc(){}")
> 01:30:26.689 undefined
> 01:30:33.614 abc()
> 01:30:33.624 undefined
>
> why can't I define a functiion using js/eval but can using eval in 
> javascript?
>
> however this works:
>
> stigmergy.loader> (js/eval "foobar123 = function(){}")
> #object[foobar123]
> stigmergy.loader> (js/foobar123)
>
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to