lua-users home
lua-l archive

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


Alex Davies wrote:
> Atm all comparisons can be handled by EQ, LT, and LE.  The VM only uses
> these (notted and operands switched where appropriate), and there are
> only metamethods for these.
Yeah, and I was glad there were only these, and no GE and GT - less to
implement :)

> To allow comparisons between different types, at least (I'm tired too)
> GE, GT would have to be added - and opcodes added to support these.  At
> least to allow the selection to be made in an intuitive manner (ie, left
> value gets its metamethod called first if present, then second).
This seems to be a good reason.

> That's the only reason I can think of... but it is quite a biggy imo.
> Well, besides from the extra error checking (where you find a type has
> leaked out that wasn't supposed to get to a numeric compare, for example).
Thanks Alex :)! I think I won't change it now. And I'll try to think of it
more when our release rush has finished :)

Sincerely,
Nick