lua-users home
lua-l archive

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


> However, there was (I thought) general agreement that we could compromise
> on partial ordering with the <, <=, =>, and > operators, leaving == and
> it's converse (which I cannot easily type on a Windows Spanish keyboard) to
> mean object identity.

The equal tag method is not for partial order. We implemented partial order
along the line pointed out by Reuben Tomas (an optional __le method).

The equal tag method is for completeness. It is strange that you can
define <, >, <=, and >=, but not == .


> Changing object identity to a function call would add far far too much
> overhead to what should be a basic operator.

There is a function call only when there is a tag method; they are only
checked when comparing tables or userdata. So the overhead is minimal,
with no overhead at all when comparing primitive types.

-- Roberto