Re: Overloaded logic operators

torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Wed, 26 Nov 2008 12:10:43 +0100

          From comp.compilers

Related articles
[7 earlier articles]
Re: Overloaded logic operators mike@mike-austin.com (Mike Austin) (2008-11-25)
Re: Overloaded logic operators lkrupp@pssw.com (Louis Krupp) (2008-11-25)
Re: Overloaded logic operators mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2008-11-25)
Re: Overloaded logic operators m.helvensteijn@gmail.com (2008-11-25)
Re: Overloaded logic operators bc@freeuk.com (Bartc) (2008-11-25)
Re: Overloaded logic operators cdodd@acm.org (Chris Dodd) (2008-11-25)
Re: Overloaded logic operators torbenm@pc-003.diku.dk (2008-11-26)
Re: Overloaded logic operators fswarbrick@gmail.com (Frank Swarbrick) (2008-11-27)
Re: Overloaded logic operators dot@dotat.at (Tony Finch) (2008-12-01)
Re: Overloaded logic operators alexc@TheWorld.com (Alex Colvin) (2008-12-03)
Re: Overloaded logic operators haberg_20080406@math.su.se (Hans Aberg) (2008-12-04)
| List of all articles for this month |

From: torbenm@pc-003.diku.dk (Torben =?iso-8859-1?Q?=C6gidius?= Mogensen)
Newsgroups: comp.compilers
Date: Wed, 26 Nov 2008 12:10:43 +0100
Organization: Department of Computer Science, University of Copenhagen
References: 08-11-110 08-11-115 08-11-121
Keywords: syntax, design
Posted-Date: 27 Nov 2008 11:59:50 EST

Mike Austin <mike@mike-austin.com> writes:


> Torben Fgidius Mogensen wrote:


>> Option 2 is chosen by some scripting languages and "p and q" is
>> typically equivalent to "if p == null then p else q" and "p or q"
>> equivalent to "if p == null then q else p", so very similar to C's
>> sequential operators. [...] If you have an Object class (top of the
>> inheritance hierarchy), this might be used [as True].
>
> I like this idea of nil and Object. true needs false... now you've got two
> falsey values - and it's all downhill from there :)


If you let null be false and the non-null Object be true, you don't
need a separate boolean type.


> Do you know of languages which use this technique?


I can't offhand remember any specific instances.


Torben



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.