lua-users home
lua-l archive

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


Hi Steve,

On 2 Apr 2013, at 16:29, steve donovan <steve.j.donovan@gmail.com> wrote:
> I still don't like this idea of hammering the global namespace so heavily.  Redefining tostring (for instance) has global effects and reminds me of the Ruby monkey-patching mania.  It makes composing different frameworks harder, even if it seems a little more convenient at first.

Agreed.

Check out upcoming v35 on the master branch.  This exactly what I've been working on... require "std" will still run rampant through the global namespace for backwards compatibility, but as of the next release, requiring modules one at a time gives you back a table of entry points -- it's then up to your code whether to access those entry points through the table, reassign them for faster lookups, or inject them into the global namespace.

Similarly, rather than dump all the modules in at the top level, as of the next release individual modules are installed to a subdirectory, and accessed with, e.g. require "std.string_ext".

This seems like the best compromise between hygiene, convenience and backwards compatibility to me.

All feedback very welcome!

Cheers,
-- 
Gary V. Vaughan (gary AT vaughan DOT pe)