[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: false [was: The "Is nil present in a table" problem}
- From: "Paul Chakravarti" <pc000@...>
- Date: Wed, 28 Nov 2001 17:13:33 GMT
Edgar Toernig writes:
But that would result in two classes of behaviour: one only accepts
true and another that accepts anything but nil/false. I'm not sure
that I would like that...
I am not sure I understand this concern - do you have an example ?
I dont think that this impacts the semantics of relational
operators other than that it is possible to test a type and
tell that it is a 'true' value (from a relational opeartor) -
almost all other code could just ignore this - ie. following
the pattern from the proposal -
- true/false are distinct types
print(type(true)) = "true"
print(type(false)) = "false"
- Relational operators return true/false
5 > 6 ==> false
1 == 1 ==> true
nil == false ==> false
1 == true ==> false
- Logical operators treat true as a non-nil type
true and 10 ==> true
10 and true ==> true
10 or true ==> 10
10 and 11 ==> 11
nil or nil ==> nil
not(true) ==> false
not(1) ==> false
not(false) ==> true