lua-users home
lua-l archive

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


Some opinions about undef. Right now, nil is needed for:
1) skip some arguments or return values in a function call
2) check presence in tables or remove something from them
3) Other ?

IMHO, the mixed solution (nil/value for 1 while undef/keyword for 2) is very
little lua-ish. It is complex and difficult to explain, also if it just adds an
handfuill of exception to care of. This because both 1 and 2 in our human mind
are recognized to model the same thing: something "Missing".

I am not saying that undef should be removed as a test feature. On the
contrary, it would be nice to have the possibility to play with a full solution
that works also for 1. I also theoretically prefer "Keyword/no-value" semantic.
But I really do not see any simple way to keep this semantic in 1.

I mean: if I can pass something to a function, and I can get it back from a
call... well it is a value!