On Sunday 14 September 2008 07:47, Rich Hickey wrote: > On Sep 14, 10:09 am, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > On Sunday 14 September 2008 05:57, Rich Hickey wrote: > > > ... > > > > > > Note also that by fn definition I mean the occurrence in code, > > > not the execution: > > > > > > (defn foo [x] (fn [] x)) > > > > > > creates two classes, no matter how many times foo is called. Each > > > call to foo creates an instance of the same class. > > > > Why is an instance creation required for an invocation? > > It's not. This function, foo, returns a closure. It is the closure > for which an instance is created.
OK. I misunderstood. So a closure is created only when the function is treated like a value? > > I thought you used the JVM stack for calling and parameter passing > > both for Clojure functions and (naturally) for calls to "ordinary" > > Java methods. > > I do. > > > If each invocation of a Clojure function requires instantiation of > > the function's class > > It doesn't. I looked at the source for clojure.lang.IFn and the invoke(...) methods are not static. What instance of the function's implementing Java class is used in cases where no closure is required? > ... > > Rich Randall Schulz --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---