lua-users home
lua-l archive

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


Am 09.04.2014 01:02 schröbte Rena:
On Apr 8, 2014, at 4:41 PM, Coroutines <coroutines@gmail.com> wrote:

I would like to see the 'in' keyword patch added to enable this: local
byte, reverse, gsub in require 'string'

For what it's worth, I think this would be a very nice addition as well.

I'm more or less indifferent to this feature request, but if implemented it won't stop the "locals blocks" completely for the following reasons:

* Compatibility. Lua 5.1 and 5.2 don't have it, so I probably won't use it until those version become more or less insignificant (or I'm depending on the newest Lua version anyway). * I prefer my localized standard functions to have a prefix (like `t_concat`), because locals like `len`, `insert`, `remove` (already ambiguous), date, time, find, match, sub, byte, etc. are likely to appear in my own code. The namespace is an important part of the function's name, IMHO. * I prefer to make sure that the field I requested is really there (using e.g. `local t_concat = assert( table.concat )`).

I guess the last two points are very specific to me, but the compatibility argument will probably be valid for other Lua users as well ...

Philipp