On Fri, Aug 12, 2011 at 4:25 PM, daly <d...@axiom-developer.org> wrote:
> Consing up a new function and using eval is certainly possible but
> then you are essentially just working with an interpreter on the data.
>
> How does function invocation actually work in Clojure?
> In Common Lisp you fetch the function slot of the symbol and execute it.
> To modify a function you can (compile (modify-the-source fn)).
> This will change the function slot of the symbol so it will execute the
> new version of itself next time.

As I indicated in the earlier post, consing up a new function and
eval'ing it actually invokes a compiler and generates a dynamic class
with bytecode. It's just as eligible for JIT as a class compiled AOT
and loaded the "usual Java way".

As for your later speculations, whether a history of earlier values is
kept is entirely* up to the programmer. They can keep older versions
around or not. If they stop referencing one, the GC should collect it
at some point (modulo some VM options needed to make unreferenced
classes collectible).

* The STM, as I understand it, may keep a history of the last few
values of a particular ref, if that ref keeps getting involved in
transaction retries. But this history isn't accessible to user code,
at least without doing implementation-dependent things that could
break in future Clojure versions. If you store a lot of big things in
refs, it could impact memory and GC performance though.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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

Reply via email to