[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [proposal] Libary changes
- From: Sebastien Lai <237482@...>
- Date: Sun, 9 Oct 2011 23:12:01 +0200
On Sun, Oct 9, 2011 at 9:47 PM, Sam Roberts <firstname.lastname@example.org> wrote:
> On Fri, Oct 7, 2011 at 6:42 AM, Sebastien Lai <email@example.com> wrote:
>> 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).
> Attaching a common prefix, sys., to completely unrelated things is an
> unusual approach to make code more readable.
Since when equals "attaching a prefix to something" to "defining
elements in a table"? Or do you think "io", "os", "string", "table"
and "debug" are just mere prefixes, and not a tables?
> And how would it avoid ambiguous re-declaration of sys?
Redeclaration can happen in any language. Lua is no different in this regard.
> While the lua list is fairly polyglot, emulating python irritations in
> lua isn't going to go far
> on this list...
I'd love to read a cite on that :-)
> anybody who likes python knows where to find it, don't they?
I do like Python, and won't deny it. But i also like Lua.
And, if you've read previous responses this this thread, you may have
noticed that doing substantial changes in the Lua core has been rather
common in the past. For example, somewhere around Lua3 - Lua4, all
string functions where scattered around as global variables, for
example, 'strlen' instead of 'string.len'.
Now, all core libraries have their own "namespace" (and "namespace" is
the keyword you should consider here), making it easier to add your
own, say, string functions without clashing with the builtins of Lua.
And Lua is actually moving towards encapsulation of data that would
make sense to be encapsulated. As said, before there was io, os,
string and co, *everything* was pretty much scattered all around in
the global namespace.
It's all about modularity and namespacing here.
> Think, if a new python programmer named a function open, confused
> himself, and posted to the python mailing list suggesting that it not
> be global, how far do you think they'd get?
Funny you should say that; Infact, one of the reasons I wrote this
proposal is because both 'arg' and '_VERBOSE' are way too often
unknowingly overwritten, because neither '_VERSION' nor 'arg' are in
any way especially marked.
Having these tiny little wee tidbits covered up neatly in a sweet
little 'sys' namespace gets around such problems, and I would not
believe you if you told me you wouldn't think so as well.