This is interesting - are there any other cases where forms are treated specially at top-level?
On 20 September 2013 10:01, Gary Verhaegen <gary.verhae...@gmail.com> wrote: > As Meikel said in his previous mail, 'do' at the top-level is treated > specially: each form is treated as a separate top-level form. This is, for > example, useful for defining a macro that defines multiple functions. > > So what Meikel was really trying to say is that the reason (do (intern > 'user 'bob3 3) bob3) works is that it is treated the same as > (intern 'user 'bob3 3) > bob3 > > This special handling only occurs when do appears as a top-level form, > which is the reason why your other examples fail. > > On Thursday, 19 September 2013, Phillip Lord wrote: > >> "Meikel Brandmeyer (kotarak)" <m...@kotka.de> writes: >> > Clojure's compile unit is one toplevel form. Therefore >> > >> > (intern 'user 'bob3 3) >> > bob3 >> > >> > works, while >> > >> > (is (do (intern 'user 'bob2 2) bob2)) >> > >> > does not, because the former are two compilation units while the latter >> is >> > only one. (Note: (do ...) is a special case. (do (intern 'user 'bob3 3) >> > bob3) should actually work.) >> >> Yep, do on it's own does work. >> >> The problem, here, then is that a chunk of code like >> >> (do (intern 'user 'bob3 3) bob3) >> >> Sometimes works, and sometimes doesn't. And whether it does or does not >> depends on it's context. As I said in the last post, I'd worked out why >> the immediate reason it fails. But I cannot understand from looking at >> the code why >> >> (do (intern 'user 'bob3 3) bob3) >> >> is two compilation units, while >> >> (is (do (intern 'user 'bob3 3) bob3)) >> >> or >> >> (try (do (intern 'user 'bob3 3) bob3)) >> >> are both one (the latter fails also). >> >> Seems rather like a bug to me. If the compiler can identify that >> >> (is (do (def bob3) bob3)) >> >> is valid, the same should be true for an intern form. >> >> Phil >> >> -- >> -- >> 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 >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.