Tim, I see in clojure a var named ALLOW_UNRESOLVED_VARS.
Could you explain me how it works compared to the new AUTO_DEF that is introduced ? I think there's a subtlety between resolved var / defined var that I don't understand right now ... Thanks, -- Laurent 2009/3/16 Timothy Pratley <timothyprat...@gmail.com> > > Just FYI, > > The actual patch is in the files section: > http://groups.google.com/group/clojure/web/auto-def.patch > With an example: > http://groups.google.com/group/clojure/web/lit-wc.clj > From a longer thread about 'snake' which talked about literate > programming: > > http://groups.google.com/group/clojure/browse_thread/thread/2a23a95bf22938a3 > > It does not implement existence checking upon completion of compile > unit. How exactly should this work? We can keep a set of symbols auto- > defined and 'at checkpoint' test if they are still undefined... > however what is the 'checkpoint'? For fully compiled code the > 'checkpoint' is clear - but Clojure is dynamic... what should happen > with this code: > > (defn myfun [] > (another-fun 5)) > (myfun) > (defn another-fun [x] > (inc x)) > > In a compiled language that would be valid, but in a dynamic language > it is a runtime error. I don't see how to overcome this, which makes > auto-def quite useless :) It seems you either need to accept top-down > or accept undefined symbol runtime errors. There is a third > alternative, which is to use Knuth's literate programming technique of > actually writing your code in TeX and have it transformed from there > to either code or documentation... but again for interactive > development that is quite rigorous. > > > Regards, > Tim. > > > > On Mar 17, 7:54 am, David Nolen <dnolen.li...@gmail.com> wrote: > > Here's the post by Timothy talking about patching the compiler: > > > > http://groups.google.com/group/clojure/msg/ef5bae605f4a0730 > > > > On Mon, Mar 16, 2009 at 4:36 PM, Paul Stadig <p...@stadig.name> wrote: > > > On Mon, Mar 16, 2009 at 4:18 PM, David Nolen <dnolen.li...@gmail.com > >wrote: > > > > >> On Mon, Mar 16, 2009 at 4:08 PM, Paul Stadig <p...@stadig.name> > wrote: > > > > >>> I may be missing something, but how does having to (declare) vars fix > > >>> typos? I don't think anyone is suggesting *creating* a var that is > > >>> referenced before it is defined. What people are asking for is that > the > > >>> compiler looks-ahead to verify that the var will eventually be > defined, and > > >>> then go on its merry way. Typos would still be discovered, and people > > >>> wouldn't have to stop and (declare). > > > > >> Yeah I wasn't suggesting that vars should be created, sorry if it > sounded > > >> like I was (I mentioned declare because this came up in another thread > about > > >> declare and someone had hacked the reader to not bail immediately on > > >> undefined symbols). > > > > > Sorry, my fault. I was just responding in general, not to you > specifically. > > > > >> In CL, if you have definitions out of order in the compiler will issue > > >> warnings. > > > > >>> I'm not saying it's an easy change... > > > > >>> Paul > > > > > Could someone post the link to the previous discussion? I searched the > > > group for declare, but didn't turn up anything. > > > > > Paul > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---