Re: Overloaded logic operators

Chris Dodd <cdodd@acm.org>
Tue, 25 Nov 2008 22:43:43 -0600

          From comp.compilers

Related articles
[6 earlier articles]
Re: Overloaded logic operators mike@mike-austin.com (Mike Austin) (2008-11-25)
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: Chris Dodd <cdodd@acm.org>
Newsgroups: comp.compilers
Date: Tue, 25 Nov 2008 22:43:43 -0600
Organization: Compilers Central
References: 08-11-110 08-11-114 08-11-123
Keywords: syntax
Posted-Date: 27 Nov 2008 11:59:16 EST

Louis Krupp <lkrupp@pssw.com> wrote in news:08-11-123@comp.compilers:
><snip>
>> [The A < B < C syntax has been part of Cobol for many decades. It seems
>> to work fine there. -John]
>
> Are you sure that's in COBOL? It doesn't sound familiar, and I don't
> have a COBOL manual handy.


My recollection is that A < B < C syntax comes from ICON and possibly
something earlier (SNOBOL?) as well.


In ICON, there is no boolean type; instead there is a special FAIL value. In
tests, FAIL is false and everything else is true. So A < B returns B if both
A and B are numeric values and A < B, and FAIL otherwise. So A < B < C is
just parsed as (A < B) < C and ends up doing the expected mathematical test.
ICON also allow you to write things like A < (B | C) which is equivalent to
A < B or A < C


Chris Dodd
cdodd@acm.org


Post a followup to this message

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