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 <hmnj...@gmail.com> 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 clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > 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 clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.