lua-users home
lua-l archive

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


Paul Chakravarti wrote:
> 
> >> (http://lua-users.org/wiki/BooleanTypeProposal)
> >
> 
> I had a slight question/concern with the following -
> 
>  -- Relational operators return false for false and a value other than
>  -- false/nil for true

In fact, they always return the number 1 for true.  Maybe it's better
to say that explicitely (and define true to be 1).  That way

   (a==b) == (c==d)

and alike becomes valid.

> For orthogonality I would be useful to also have a 'true' type such
> that
> 
>  -- Relational operators return 'false' for false and 'true' for true
> 
> Assuming 'true' was a non-nil value I dont believe this changes the
> semantics of any relational operators

And then define that if/while/not/... only accept 'false' and 'true'?
I thought about it myself but IMHO it complicates things more than
it would help.

Ciao, ET.