lua-users home
lua-l archive

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



I like the suggestion. And it should be easy to disallow using globals (from within objects) completely, if needed.

I'd say - go for it!  :)

-asko


troels knak-nielsen kirjoitti 10.4.2009 kello 21:18:

On Fri, Apr 10, 2009 at 7:24 PM, Martin C. Martin
<martin@martincmartin.com> wrote:
For an OO style while accessing fields is more common than globals, the environment option seems cleaner than the standard : option. Are there any
down sides that I'm missing?


"clean" is such a loaded term.

Obviously, your suggestion makes for an ambiguous syntax. Java doesn't
have this problem, because there is no global scope - only an object
scope. An additional issue in Lua, is that the same function may have
different roles in different situations (Some times as a member
function - some times not). I'm sure this will further complicate
matters/add to the ambiguity.

From a technical viewpoint, I would venture to guess that it would
bare the cost of an extra lookup, which impacts performance.

--
troels