[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: syntactic sugar for imports and exports
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Fri, 21 Oct 2011 18:20:52 +0200
2011/10/20 Tony Finch <dot@dotat.at>:
> [...]
>
> -- syntactic sugar for require
>
> library = setmetatable(package.loaded, {
> __index = function (_, name)
> return require(name)
> end
> })
>
> -- get math and io modules from the library
>
> local math, io <- library
That proposal is smart, and very refreshing. Whatever the outcome, I
believe that's good food for thoughts :-)
As I personnally prefer keywords to symbols (in the context of Lua at
least), I'd rather have "from" be used instead of "<-" (since that's
how you read, why not write it that way?).
Injection on the other hand sounds less useful, and at the same time I
can't think of a good keyword to put in the place of your syringe
operator. A very bad one would be "sucks" (I'm not a native english
speaker and I can't find a better synonym):
tbl -< foo, bar, zig
becomes
tbl sucks foo, bar, zig -- from the globals
- References:
- modules, require, magic, Eduardo Ochs
- Re: modules, require, magic, Javier Guerra Giraldez
- Re: modules, require, magic, Petite Abeille
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, David Manura
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Tony Finch
- Re: modules, require, magic, Hisham
- Re: modules, require, magic, Tony Finch
- syntactic sugar for imports and exports, Tony Finch