lua-users home
lua-l archive

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


On Wed, Mar 14, 2018 at 3:11 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> That is true. But you cannot pass 'undef' to a function or return
> an 'undef' from a function (anymore than you can pass 'while' to a
> function).

Sorry Roberto, my previous comment was a bit confusing. The point was:

1) The LUA_NILINTABLE patch uses undef for table content deletion and
existence check, but not in the only other place we need nil: function
arguments and returns
2) I do not see any easy way to use undef in that place without make
it a value [1], i.e. falling back to the nil solution.
3) So if the undef will stay, it will always be in a mixed solution:
nil for functions, undef for tables. I found this scenaio to be ugly
due to its complexity when compared with the current situation.

At this point I want to ask to the list: does someone see an easy
solution for optional arguments/returns that does not involve a nil
value?

In that case I would be very interested to see a nil-less lua
experiment (or a keyworded-nil lua, if you prefer call it that way)!

[1] Well, actually one can guess a syntax like `func(a, , b)` or
`return a, , b`. But what `a,b,c = func()` should means when one of
the return values is missing?