[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [proposal] Libary changes
- From: Marc Balmer <marc@...>
- Date: Fri, 07 Oct 2011 15:47:45 +0200
Am 07.10.11 15:42, schrieb Sebastien Lai:
> Before I start: This proposal might or might not be somewhat biased on
> my previous experience with modular programming languages like python
> and co.
>
> What I bothered me most about Lua is the way global
> "more-or-less-constant" variables are declared - meaning especially
> _G, _VERSION, and the variable "arg" containing the arguments vector
> passed to 'main' in the native environment (usually C and/or C++, but
> also Java, CSharp, etc).
>
> What I propose is to create a new module named "sys", that will
> respectively contain that data instead, like:
>
> sys.argv instead of arg
> sys.globals instead of _G
> sys.version instead of _VERSION
Do you know what that would mean to all the existing codebase... ?
Every that uses the current form would have to change his software just
because of your personal taste? You can't be serious?
>
> In my opinion, that would make more readable, and possibly avoid
> ambigious re-declaration of 'arg' (that unfortunately happened to me
> before, when I learned Lua, for example).
>
> Having a 'sys' module might also make it more interesting to share
> some more lowlevel information acquirable through the C
> standardlibrary with Lua, instead of polluting the global namespace.
>
> And, similar to 'os' and 'io', this module should be part of the
> global namespace.
>
> What do you guys think?
Impractical and quite crazy to even suggest such a change. If you dont
like _G etc. why don't you make a table for you that contains these
elements? That would be easy enough.