Re: Outers, fields and locals

Darius Bacon <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
Thomas Leonard <[email protected]> wrote:
> EvalContext holds three arrays:
> 
>     private final Object[] myLocals;
>     private final Object[] myFields;
>     private final Slot[] myOuters;
> 
> What's the difference between these? My current guess is:
> 
> - locals is a new set of bindings created each time you invoke a
> method and includes the local variables and the method's arguments.
> - fields are the values that were in scope when the object was defined
> and which are used in the object and which aren't in safeScope.
> - outers is everything else.

Almost. IIRC, outers are module-level and top-level variables. This
reduces the amount of copying needed to create a closure; if we had
only myLocals and myFields, then myFields would usually be much
larger. The outers arrays can be shared, one per module.

(It's been most of a decade since I dealt with this code; you should
get someone who still knows it better.)

Darius
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.