Maybe the reader does _not_ eagerly resolve "c/foo" when the top-level enclosing form is a "do", but it _does_ eagerly resolve "c/foo" when the top-level enclosing form is a function?
On Jan 3, 10:02 am, Mike Hogye <stacktra...@gmail.com> wrote: > Now that you understand it, can you explain it me? :) > > This simplified version of your snippet still throws the "No such > namespace: c" exception: > > (ns coretest) > (defn foo [x] x) > (= 1 > (do > (alias 'c 'coretest) > (c/foo true))) > > But the following completes without any exceptions: > > (ns coretest) > (defn foo [x] x) > (do > (alias 'c 'coretest) > (c/foo true)) > > Only difference is whether or not the result of the "do" expression is > used as arg in a call to "=". I'm stumped. > > On Jan 3, 9:28 am, Roger Gilliar <ro...@gilliar.de> wrote: > > > > > > As I understand it, the Clojure reader expects to be able to resolve > > > namespace references as soon as it sees them. Since "alias" is a > > > function, the "c" alias doesn't exist until sometime after the reader > > > has already run. I think you will encounter a similar problem with > > > the import macro. > > > Ok, > > > that makes sense somehow. Thanks for the explanation. > > > Regards > > Roger -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en