home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!psinntp!gatekeeper.nsc.com!voder!woodstock!news
- From: dyer@airplane.sharebase.com (Scot Dyer)
- Subject: Re: applying or
- Message-ID: <1992Dec31.181545.19917@sharebase.com>
- Nntp-Posting-Host: airplane
- Reply-To: dyer@airplane.sharebase.com (Scot Dyer)
- Organization: NCR/ShareBase Corporation
- References: <PK.92Dec28100620@talitiainen.cs.tut.fi> <HULTQUIS.92Dec28102345@wk206.nas.nasa.gov> <MOB.92Dec30090646@strident.think.com> <1hsiocINN2v6@columbia.cs.ubc.ca>
- Date: Thu, 31 Dec 92 18:15:45 GMT
- Lines: 45
-
- From: manis@cs.ubc.ca (Vincent Manis)
- /// In article <MOB.92Dec30090646@strident.think.com> mob@strident.think.com
- /// (Mario O. Bourgoin) writes:
- /// >I am at a loss for naming an existing programming language that has AND
- /// >and OR and where they do not have the same behavior as they do in Scheme.
- /// >Would some programming language cogniscenti be kind enough to name a few?
- ///
- /// ISO Pascal, for one. Ada, for another (Ada has both McCarthy and
- /// `operator' booleans: I think the former is written `and then', and the
- /// latter just as `and').
-
- A large number of _later_ Algol derivates contain the 'and then' and 'or then'
- control constructs. The reasoning in seperating them was that in many cases
- the conditional evaluation was required for correct code (as in a check for
- divide-by-zero or null-pointer-dereference), but that WHERE IT WASN'T
- (required) the compiler could generate more efficient code for 'and' and 'or'
- by having the choice of which to evaluate "first." (What's currently in the
- machine registers? Hmmm....) So take your pick of Algol, Simula, SAIL, etc.
-
- I don't believe any of these languages guarantee that all the sub-expressions
- will be evaluated*. I think the biggest difference is whether the compiler is
- allowed to try to optimize which order things are eval'ed in.
-
- /// The subject of this thread is a clear indication why there's a problem.
- /// People insist on thinking of `and' as a procedure, no doubt because many
- /// computers have an AND instruction. `and' is a control operation, just as
- /// are `if' and `cond'.
-
- This is an inconsistancy in Scheme itself, IMHO. I think the distinction
- between "special forms" and "procedures" could be avoided entirely if
- "lambda" were revisited. This would be more expensive, yes, but elegant.
-
- Even in Algol, implicit delayed evaluation of procedure parameters was
- allowed -- a scary coincidence, yes? :)
-
- +------------------------+-----------------------------------------------+
- |Scot Dyer_Rivenburgh | "Land of song," said the warrior bard, |
- |dyer@eagle.sharebase.com| "Though all the world betrays thee, |
- +------------------------+ One sword, at least, thy rights shall guard, |
- |(He's right, you know.) | One faithful harp shall praise thee." |
- +------------------------+-----------------------------------------------+
-
- * except ISO Pascal which I know squat about. It would be wirthian to provide
- a "clean operator" (and damn the awkwardness that _everything_ can't be an
- "operator!")
-