[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Ideas for method chaining implementation
- From: Mark Hamburg <mhamburg@...>
- Date: Wed, 06 Jul 2005 13:46:18 -0700
Separate environments are the issue. If one wanted inheritance, one can get
that by creating appropriate environments.
Note that this is more a theoretical question as opposed to a specific issue
with venv. It came up because method chaining could benefit from using
custom function environments, but it isn't really safe for the class
constructor to just slam the function environment since the environment may
already have been changed in some other use of a function.
on 7/6/05 1:15 PM, Tomas at email@example.com wrote:
> Hi Marc,
>> It doesn't, however, address the issue I was raising since when it does a
>> setfenv on the function to be wrapped, it will stomp any existing
>> environment. In particular, I can't write:
>> f1 = venv( f )
>> f2 = venv( f )
>> And have separate environments for the functions.
> You are right. venv() is changing the environment of the given
> function. I've just corrected that, but if the given function had an
> environment different from the global, it will be ignored. I'm still
> trying to solve this...
> What I missed is if you need just the separate environments or
> if you need also that the new environment inherit from the old one.