On Wednesday, January 20, 2016 at 7:41:10 PM UTC+3, Mike Fikes wrote:
> Hi Andray,
> 
> 
> Can you provide an example. FWIW this is working for me:
> 
> 
> 
> foo.core=> (cljs/eval-str st "(defn square [x] (* x x))" 'test {:eval 
> cljs/js-eval} cb)
> #object[cljs$user$square "function cljs$user$square(x){
> return (x * x);
> }"]
> nil
> foo.core=>
> 
> 
> 
> 
> Hi, Maria!
> 
> I tried to eval clojurescript form in clojurescript via eval-str and it works 
> for code without functions.
> If i add 'defn' form then error occurs. I debugged it and first of all 
> following thing is suspicious: during analyzing defn we are dispatched into 
> core$macros.js functions where .core.cst$sym$cljs$core$macros_SLASH_fn is not 
> defined but similar cljs.core.cst$sym$cljs$core_SLASH_fn symbol is defined in 
> constants_table.js
> Can you advice me where i can have a look to resolve my problem?
> 
> Thanks in advance
> 
> ps by the way can you explain me when core$macros.js and constants_table.js 
> come to play during transpiling?
> 
> -- 
> 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.

Hi, Mike!
I am doing similar things:

(defn node-eval [{:keys [name source]}]
    (js/eval source)
  )

 (defn add-code [code] 
     (def st (empty-state))
     (eval-str st
      ; "(ns foo.bar)\n
      ;  (print (rest [1 2 3]))"

      ; "(ns foo.bar)
      ;   (print (+ 1 2))"

      ; "(ns foo.bar)
      ;   (def x 1)
      ;   (def y 2)
      ;   (print x)
      ;   (print y)
      ;   (print (+ x y))"

       "(defn my-func [x] (print x))"
      'foo.bar
      {:verbose true
       :source-map true
       :eval node-eval
       ;:load node-load
      }
      (fn [{:keys [error] :as res}]
        (print "continuation")
        (if error
          (do
            (println error)
            (println (.. error -cause -stack)))
          (println res))))


i am using clojurescript 1.7.228
I have following difference: i cant explicitly import cljs.core/js because of 
its circular dependency on cljs.core->cljs.core if my cljs file contains only 
require on cljs.core/js, i didnt resolve this compile time error and copy paste 
cljs.core/js.cljs content into my own executor.cljs.

-- 
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