[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Globals (more ruminations)
- From: joao lobato <btnfdp.lobato@...>
- Date: Fri, 16 Jul 2010 01:19:30 +0100
May I humbly suggest that we leave all the global/local thing as it
is? We have learned to live with it, so can the next batch of Lua
programmers.
Well, actually, I'd kinda prefer 'var' over 'local'...
On 7/15/10, Geoff Leyland <geoff_leyland@fastmail.fm> wrote:
> On 16/07/2010, at 8:20 AM, Roberto Ierusalimschy wrote:
>
>>> Does this mean that if we wish to have global checking for variables
>>> in a module, we'll have to go "global function" for the rest of the
>>> module to get module functions? From the first global on function
>>> mymodulefunction(...) will be an error right?
>>
>> Right.
>
> So I was going to suggest that "function(...)" becomes sugar for "global
> function(...)" but doesn't turn on global checking for its scope). It's
> based on the unsubstantiated guess that "a = 1" is more likely to be
> intended to be a local than "function f(...)", but now I don't think it's a
> good idea.
>
> If you put "global CHECK" at the top of your file, then with this, the
> advantage is you won't have to type "global" at the start of your file-level
> functions. The problem is that you won't get global checking for functions
> defined inside functions and other scopes.
>
> I guess what's bugging me is that the global proposal doesn't completely
> dominate strict.lua: strict.lua checks assignments to globals in scopes
> other than the top level without any changes to the code. The global
> proposal offers static checking and can check the top level, but at the cost
> of more changes to the code.
>
> Cheers,
> Geoff
- References:
- Re: Globals (more ruminations), Mark Hamburg
- Re: Globals (more ruminations), Roberto Ierusalimschy
- Re: Globals (more ruminations), Geoff Leyland
- Re: Globals (more ruminations), Alexander Gladysh
- Re: Globals (more ruminations), Roberto Ierusalimschy
- Re: Globals (more ruminations), Juri Munkki
- Re: Globals (more ruminations), Roberto Ierusalimschy
- Re: Globals (more ruminations), Patrick Donnelly
- Re: Globals (more ruminations), Roberto Ierusalimschy
- Re: Globals (more ruminations), Geoff Leyland
- Re: Globals (more ruminations), Roberto Ierusalimschy
- Re: Globals (more ruminations), Geoff Leyland