On 21 Oct 2009, at 17:58, CuppoJava wrote: > The part that I'm having trouble understanding is the fact that > functions can be defined at runtime. How do you compile a function > that's not defined until after you run the program?
It is possible to define functions at runtime only by calling eval on a form that evaluates to a function. These functions are obviously not compiled "ahead of time" (a rather strange expression), they are compiled when eval is called. This is why the Clojure compiler is part of the run-time system. Perhaps you were thinking of functions that return functions. These functions are perfectly well defined statically, they just usually capture variables from their surrounding functions, i.e. they are closures. Closures are compiled into classes with fields that are filled in when the closure object is created, so they pose no problem for AOT compilation. Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---