Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!csd4.csd.uwm.edu!leah!rpi!batcomputer!lacey
From: lacey@batcomputer.tn.cornell.edu (John Lacey)
Newsgroups: comp.lang.misc
Subject: Re: What I'd really like to see in an if-statement...
Message-ID: <8620@batcomputer.tn.cornell.edu>
Date: 14 Aug 89 20:57:26 GMT
References: <178@enea.se> <3829@bd.sei.cmu.edu>
Reply-To: lacey@tcgould.tn.cornell.edu (John Lacey)
Organization: Cornell Theory Center, Cornell University, Ithaca NY
Lines: 34

In talking about _Real Conditionals_ :), 
In article <3829@bd.sei.cmu.edu> of comp.lang.misc
    firth@sei.cmu.edu (Robert Firth) writes:
} The above is a feature of the language BCPL.  In simple cases, it
} works very well indeed:
} 
} 	if 'A' <= ch <= 'Z' do ...
} 
} In complicated cases, it can trip you up:
} 
} 	if x < f() < y do ...
} 
} might call f() once or twice, for reasons difficult to explain to a
} beginner.  And beginners have this habit of trying complicated cases,
} rather the way kittens like ravelling string.

Then, the above is _not_ a feature of BCPL.  However, you weren't expected
to know that, unless you have been following this thread from comp.lang.c .

The original question (_way_ back) was a open switch statement that allowed
arbitrary expressions, and picked the path of one that is true (aka Dijkstra's
if-fi construct) and also *evaluated each expression only once*.  That last
is the key.  Then we moved to simply getting full blown conditionals, like
those in mathematics.  If (x < f() < y) ever has side effects problems in
math., I should change majors or something, 'cause it's time to get out. :-)

So far, Lisp, Icon, and BCPL have all tried and failed to meet the challenge
(Icon came PDClose). Any more takers?

-- 
John Lacey     lacey@tcgould.tn.cornell.edu    cornell!batcomputer!lacey

After August 16:  jjlacey@owucomcn.bitnet
If you have to, try  mdl@sppy00.UUCP or maybe {...}!osu-cis!sppy00!mdl