[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: nil semantics in Lua
- From: Cosmin Apreutesei <cosmin.apreutesei@...>
- Date: Mon, 1 Jun 2009 10:56:45 +0300
> One can create a object called Nil and use that. The trouble of course
> is that __eq only works on types that are the _same_, irritating but
> as observed it would probably slow down comparison for every other
> object if this rule was relaxed.
This compromise goes well with lua philosophy -- i get that. After
all, I could make my own implementation of slower strings and numbers
(of the same type) and use that all over the place. But then I
couldn't use string and number constants directly in operations, and
always have to wrap them in conversion function, like a == c(1)
instead of just a == 1, and a == c"asdf" instead of just a == "asdf"
.. ugly and easy to forget.