On Wed, Jan 28, 2009 at 5:24 PM, Christophe Grand <[email protected]> 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 <[email protected]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
