On Wed, Jan 28, 2009 at 5:24 PM, Christophe Grand <christo...@cgrand.net> wrote: > > Mark Volkmann a écrit : >> What are some benefits of allowing two ways of doing the following? >> [...] >> There are two ways to invoke a constructor to create a Java object. >> (def calendar (new GregorianCalendar 2008 3 16)) >> (def calendar (GregorianCalendar. 2008 3 16)) [...] > The first way makes macros easier to write. > > eg: > `(new ~a-class) instead of (list (symbol (str (name a-class) \.))) > > The second way is just "syntax" sugar: > user=> (macroexpand-1 '(Foo.)) > (new Foo)
Well, I prefer (new Foo) to (Foo.) anyway, because it's much harder to miss "new" than it is to miss "." :) -- Michael Wood <esiot...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---