On Wed, Feb 20, 2013 at 1:12 PM, William Tanksley, Jr
<[email protected]> wrote:
> Raul Miller <[email protected]> wrote:
>> As for the definitions not being mutable, those definitions are
>> irrelevant.
>
> I'm sorry to interrupt, but I don't understand that sentence. I'll
> explain after I let you finish.

I'll try again:

1. A mutable environment may contain immutable definitions.

2. Immutable definitions may also be represented without involving a
mutable environment.

So I see no need to remove "mutable" from the phrase "mutable
environment" to accomodate "immutable definitions".  From my point of
view, immutable definitions are a relevant distinction and need no
special accomodation.

>> They can be included in the environment (and marked as
>> immutable) or excluded from the environment (leaving us with
>> potentially an empty environment) and both implementations can be
>> correct.  This avenue of discussion is like asking whether 0 is a
>> number when it does not count anything.
>
> It _sounds_ like you think "the definitions are immutable" means the
> same thing as "there are no definitions". That can't be what you mean.

I agree: that is not what I mean. But "there are no definitions" can
be a viable implementation of "immutable lexical closure".

> Even if the outside variables are immutable we would still need the
> closure, because different closures can have different environments
> even if they're all created by the same parent-function (for example,
> one of the variables the inner function refers to might be related to
> an input parameter of the parent function).

Here, the choice of environments is an example of mutation.

This is a different kind of mutation than some other kinds of
mutation.  Switching environments has a different kind of atomicity
than replacing a single name/value association within the environment,
and probably uses a different interface.  But we are still talking
about changing the values involved.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to