lua-users home
lua-l archive

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

I agree it's sometimes useful to see if a value == nil. Could nil be
given an __eq metamethod?


2009/6/1 Gé Weijers <>:
> You're advocating that x ~= nil for all x (including nil). That may be
> useful in an SQL environment, but silly when you want to determine the
> end of a linked list.
> Gé
> On Mon, 2009-06-01 at 02:37 +0300, Cosmin Apreutesei wrote:
>> I wonder why lua didn't adopted sql-like semantics for nil, i.e. nil
>> transcends all types, short-circuits standard operations and
>> functions, and nil ~= nil. It got good with tables though (although
>> many ppl see that differently). IMHO, it would had resulted in more
>> composability of standard functions and functional idioms, thus more
>> expressivity.