[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug on octave 3.1.51+ with pkg install
From: |
John W. Eaton |
Subject: |
Re: Bug on octave 3.1.51+ with pkg install |
Date: |
Thu, 21 Aug 2008 11:21:54 -0400 |
On 21-Aug-2008, Jaroslav Hajek wrote:
| Could there just be parentage relations between scopes? That seems
| simpler. A subfunction (or anonymous function) would just set up a
| proper parent scope for its local scope. Name lookup, when
| unsuccessful in a given scope, would simply proceed recursively on
| parent scope, until there is no parent. There would be no need for
| inherit (), I think.
| Or is there a catch that I don't see?
I think the call to symbol_table::inherit is needed to provide values
for the otherwise unbound variables in the anonymous function scope,
and those values must come from the current scope at the time the
anonymous function handle is created. For example, try this:
x = 1;
afh = @() x;
afh ()
x = 2;
afh ()
Both calls to afh should print ans = 1 even though the value of x in
the parent scope has changed to 2 by the time of the second call.
jwe
- Re: Bug on octave 3.1.51+ with pkg install, Michael Goffioul, 2008/08/18
- Re: Bug on octave 3.1.51+ with pkg install, David Bateman, 2008/08/18
- Re: Bug on octave 3.1.51+ with pkg install, Jaroslav Hajek, 2008/08/18
- Re: Bug on octave 3.1.51+ with pkg install, David Bateman, 2008/08/18
- Re: Bug on octave 3.1.51+ with pkg install, John W. Eaton, 2008/08/20
- Re: Bug on octave 3.1.51+ with pkg install, John W. Eaton, 2008/08/20
- Re: Bug on octave 3.1.51+ with pkg install, Jaroslav Hajek, 2008/08/21
- Re: Bug on octave 3.1.51+ with pkg install,
John W. Eaton <=