[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Some crazy stuff (was Lua 5.3 changes to .__eq)
- From: Sean Conner <sean@...>
- Date: Tue, 14 Jul 2015 02:06:54 -0400
It was thus said that the Great Mike Nelson once stated:
> In my heavily hacked personal copy of Lua which I use for
> experimentation, I go one further: If either operand regardless of type
> has an .__eq metamethod, a==b returns the result of the appropriate
> metamethod even if rawequal(a,b) returns true, thus allowing such
> atrocities as 7==Complex:new(7,0) to return true and a==a (where a is a
> usertype with a nan-like value) to return false. I'm now working on the
> C code to have a>b call a's .__lt metamethod if both operands define
> metamethods, and to have a<=b in the absense of .__le metamethods but
> the presence of .__lt metamethods be evaluated as (a==b) or (a<b) rather
> than the current not (b<a).
>
> The above is strictly for fun and contains no serious proposals, but I
> have used my hacked copy to experiment with changes suggested on the list.
How have some of those changes worked out?
-spc