Content deleted Content added
No edit summary |
No edit summary |
||
Line 64:
----
Re: typical implementation as "a set of values that record the values of the relevant variables in the function's lexical environment at the time of binding", this was not correct. A naive Lisp interpreter can implement a closure as a pair containing a pointer to the function and a pointer to the actual lexical environment (activation record) at the point of capture. There's no recording of values, or selection of relevant variables for capture. Wasteful and slow, but adequate. [[User:K.lee|k.lee]] 17:27, 24 Oct 2003 (UTC)
----
I have just edited the page such that the [[Java programming language|Java]] simulation section has "<tt>final</tt>" instead of "immutable". My understanding of the term immutable in the context of [[Java programming language|Java]] is that it means once you have a reference to the object its internal state will never change i.e. all fields (including private ones) can be declared final and all references that the object holds are themselves to immutable objects. This property, as far as I know, is not detected or enforced by the runtime and is not necessary for a local variable to be used in an anonymous inner class. The meaning of the keyword <tt>final</tt>, on the other hand, is that the value of the variable will never change which object it references (or will never change value if a primitive). It is this that is necessary for the anonymous inner type to make use of the variable so that the runtime can simply clone the primitive values and object references of final variables on the stack when instantiating the anonymous inner class.
--[[User:Jwal|Jwal]] 18:35, 12 Jun 2004 (UTC)
|