lua-users home
lua-l archive

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

Javier Guerra Giraldez <> writes:

> On Monday 28 July 2008, E. Wing wrote:
>> Sorry, now I'm really confused:
>> {1,2} and {1,2} look visually identical to me.
> {1,2} is a call to a table constructor, it allocates a new and unique table 
> and populates with values.  a new {1,2} allocates ANOTHER new and unique 
> table, with the same values
> try:
> lua -e 'print ({1,2}=={1,2})'
> ==> false

In my opinion, there is a difference between "{1,2} and {1,2} are
different" and "({1,2} ~= {1,2})".  The first statement in my opinion is
nonsense, since the comparison is implied to be done on a
textual/lexical fragment base outside of Lua and it is not at all clear
what measure of equivalence is supposed to be used.

I would also consider it stupid to claim in Lisp that 3.5 is different
from 3.5 just because (eq 3.5 3.5) is nil.  The objects created by
separately feeding 3.5 and 3.5 to the reader are not eq-identical.  They
are, however, eql-same and equal-equal.

Just because Lua has a single operator for equality does not mean that
"different" has a single concept and meaning when talking informally
about the language.

David Kastrup