There may be a bug related browser REPLs and spurious errors in the latest ClojureScript releases. It's a bit difficult to try all the different combinations of settings that may trigger them. Help is always welcome to isolate and patch such bugs.
David On Mon, May 5, 2014 at 10:55 AM, Paul Butcher <[email protected]> wrote: > I’ve created a minimal Compojure/ClojureScript project: > > https://github.com/paulbutcher/csrepl > > The CojureScript source simply declares a namespace and an atom and waits > for a REPL connection: > > (ns csrepl.core > > (:require [clojure.browser.repl :as repl])) > > > (enable-console-print!) > > > (def app-state (atom {:text "hello world"})) > > > (println (:text @app-state)) > > > (repl/connect "http://localhost:9000/repl") > > > If I connect a REPL, I can access the app-state atom as you would expect: > > $ lein trampoline cljsbuild repl-listen > > Running ClojureScript REPL, listening on port 9000. > > To quit, type: :cljs/quit > > ClojureScript:cljs.user> csrepl.core/app-state > > #<Atom: {:text "hello world"}> > > > But, if I try to switch to the csrepl.core namespace and do the same, I > get an apparently spurious “undeclared Var” warning (apparently spurious > because I can still retrieve the value of the atom): > > ClojureScript:cljs.user> (ns csrepl.core) > > nil > > ClojureScript:csrepl.core> app-state > > WARNING: Use of undeclared Var csrepl.core/app-state at line 1 <cljs repl> > > #<Atom: {:text "hello world"}> > > ClojureScript:csrepl.core> (:text @app-state) > > WARNING: Use of undeclared Var csrepl.core/app-state at line 1 <cljs repl> > > "hello world" > > > Even stranger, once I’m in the csrepl.core namespace, I get the same > warning even when using the fully qualified name: > > ClojureScript:csrepl.core> csrepl.core/app-state > > WARNING: Use of undeclared Var csrepl.core/app-state at line 1 <cljs repl> > > #<Atom: {:text "hello world"}> > > > Does anyone have any idea what’s going on here? Am I misunderstanding how > things should work in the ClojureScript REPL? Or is this a bug? > > -- > paul.butcher->msgCount++ > > Silverstone, Brands Hatch, Donington Park... > Who says I have a one track mind? > > http://www.paulbutcher.com/ > LinkedIn: http://www.linkedin.com/in/paulbutcher > Skype: paulrabutcher > > Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel > http://pragprog.com/book/pb7con > > -- > 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 http://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 http://groups.google.com/group/clojurescript.
