Article View: comp.lang.misc
Article #474Re: What I'd really like to see in an if-statement...
From: John Lacey
Date: Mon, 14 Aug 1989 20:57
Date: Mon, 14 Aug 1989 20:57
34 lines
2002 bytes
2002 bytes
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
Technical Details
Message-ID:
<8620@batcomputer.tn.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!csd4.csd.uwm.edu!leah!rpi!batcomputer!laceyReferences:
<178@enea.se> <3829@bd.sei.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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