[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: global
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Fri, 19 Apr 2002 18:49:57 +0200
Peter Loveday wrote:
> I suppose for me the ideal would be an explicit global declaration
> and local-by-default behaviour.
> Love, Light and Peace,
> - Peter Loveday
This is much like it is done in PHP, and I also would prefer
something like this. Variables within function scope should
override variables within global scope. We don't even need a
seperate keyword, as long as we have a table like 'globals' or
such in which all global variables are kept.
So for example:
bar = 10;
bar = 5; -- this bar is local to foo()
bar = globals.bar;
-- Get your global bar like this.
-- It is ugly, but global variables are
-- usually a bad idea anyway.
Should then print:
On top of that, a 'global x' keyword could be allowed as
syntactical sugar for 'x = globals.x'.
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer