lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I think I like what Roberto Ierusalimschy is suggesting, assuming I'm
> understanding it correctly. Here's how I see a "global" declaration
> keyword working:
> 
> [...]

Your interpretation (so far, at least) is correct.


> When you "require" a library, the loaded code chunk should revert to the
> default (non-checked behavior) for backward compatibility.

Like the global declarations themselves, the "global check" status would
have lexical scoping. So, the loaded code chunk is not affected by the
"global status" of the loading chunk.


> Should function declarations (as above) be exempt or should I have written
> global function hello()? I kind of like the idea of checking function
> declarations as well.

Function declarations should be declared as well (probably with that
"global function foo ..." syntax, similar to "local function foo").

-- Roberto