lua-users home
lua-l archive

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


> On Nov 19, 2013, at 8:11 PM, Isaac Dupree <ml@isaac.cedarswampstudios.org> wrote:
> 
> Then, inevitably, you believe equality should be non-transitive or non-symmetric.
> 
> Given
> A:  2 == true
> B:  3 == true
> Then
> C:  true == 3   (symmetry, B)
> D:  2 == 3      (transitivity, A, C)
> 
> You probably don't want "2 == 3" to be true.
> 
> -Isaac

if 2 == 3 then print("whoops") end 	-> no output

I think I am safe. 0 is false and everything else is true only relates to boolean operations, not numeric ones.

So given your statement above where 2 and 3 are true, then yes 2 == 3 is true for boolean only operations, assuming you have assigned 2 and 3 to boolean values, which in most languages would make them both equal to 'true', no longer '2' and '3'.

In Lua numbers are compared to numbers and bools are compared to bools. My patch adds one exception, which is when a number and a bool are compared and only when those two types are compared. Otherwise the comparison between like data types takes precedence :)

~pmd~