[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: nil semantics in Lua
- From: Vaughan McAlley <ockegheim@...>
- Date: Mon, 1 Jun 2009 15:53:43 +1000
I agree it's sometimes useful to see if a value == nil. Could nil be
given an __eq metamethod?
2009/6/1 Gé Weijers <firstname.lastname@example.org>:
> 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.
> 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