[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: local by default?
- From: Victor Bogado da Silva Lins <bogado@...>
- Date: 29 Apr 2002 14:55:15 -0300
On Mon, 2002-04-29 at 14:49, Reuben Thomas wrote:
> > this is simple is there is no local value then try a global value if
> > there is no global then create a local value.
> But what if you wanted to read an unitialised local?
> while ... do
> if foo then ...
> foo = bar ()
> here, I clearly want foo to be local, without declaring it. But you're
> forcing it to be global. That doesn't sound like local by default!
Only if there is a global named foo. Also you could initialize a local
value with nil before entering the loop like this:
foo = nil
while ... do
if foo then ...
foo = bar ()
Since foo is local then you are not damaging any value initializing it.
The global one would be unharmed.
's Victor Bogado da Silva Lins