lua-users home
lua-l archive

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

On Oct 5, 2010, at 4:33 PM, Nilson wrote:

> Why not a "syntactic sugar" like:
>  "local M.exportedFunction1 = function() end" or "local
> M.exportedFunction1 () end"
> meaning
>  "local exportedFunction1 = function() end;   M.exportedFunction1  =
> exportedFunction1" or vice-versa?
> And finally,  " return M "
> That would allow you to declare the function name only once but would
> create automatically a local function variable for a faster data
> access and also would reduce the typing effort of variables names and
> of the return statement.

That's a really interesting idea for syntactic sugar and it makes module building quite straightforward. Of course, it is misleading in that:

	--- code
	name = "foo"

sets the local but not the value in M (and = "foo" would do the opposite).