This might help https://github.com/ctford/klangmeister/blob/master/src/klangmeister/compile/eval.cljs#L86
On Thu, Dec 22, 2016 at 6:06 PM, Hyeongmin Jeon <[email protected]> wrote: > Thank you for your help. I get the general idea but, (eval '(require > '[cljs.spec])) complains about *load-fn* not set. I thought there's a > default *load-fn* in compiler but clearly not. And successful eval like > (eval '(+ 1 2)) doesn't return compiler state in cb function. It only > includes :value key, evaling require form will return some other key? Or is > there some other function to get compiler state? Would you please elaborate > some more? > > On Friday, December 23, 2016 at 1:49:01 AM UTC+9, Mike Fikes wrote: > > Your two calls to eval will work if you pass the mutated state into the > second call (instead of empty state). (Maintain a state var via a def or > somesuch.) > > > > In order for the require in the first form to work, you will need to > supply a load function that returns source when requested by cljs.js. In > this case your load function will end up returning the source for the > cljs.spec namespace (and any source that it transitively requires, when > requested by cljs.js). > > > > - Mike > > > > > On Dec 22, 2016, at 1:54 AM, Hyeongmin Jeon wrote: > > > > > > I want to eval the following code. > > > > > > (s/def :a/b any?) > > > > > > So far, I have wrapped it in do form with cljs.spec like this: > > > > > > (do > > > (require '[cljs.spec :as s]) > > > (s/def :a/b any?)) > > > > > > and tried to eval them separately like this: > > > > > > (eval > > > (empty-state) > > > (require '[cljs.spec :as s]) > > > ...) > > > (eval > > > (empty-state) > > > (s/def :a/b any?) > > > ...) > > > > > > but neither works, now I've read somewhere that you should provide > library loader to eval opts map. Is there some simpler way to do instead? > if not, how should you implement library loader? > > > > > > -- > > > 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. > > -- > 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. > -- 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.
