Article View: comp.lang.misc
Article #454Re: What I'd really like to see in an if-statement...
From: John Lacey
Date: Thu, 10 Aug 1989 19:37
Date: Thu, 10 Aug 1989 19:37
54 lines
2599 bytes
2599 bytes
In article <516@brazos.Rice.edu> (3383 of comp.lang.misc)
preston@titan.rice.edu (Preston Briggs) writes:
}
} And do you want it restricted to conditionals, or extended
} to all expressions/statements?
It would be a relational expression, of course, just like "a < b".
} This should all be easy; but I don't like it. It feels "unnatural."
} I think the problem is that you want to make relational operators
} into a sort of control flow thing -- not really operators at all.
} Compare + with your version of <.
}
} a+b+c means (a + b) + c
} but
} a<b<c doesn't mean (a < b) < c
} or a < (b < c)
Just because the expression doesn't commute or associate doesn't mean
it is not a valid relation. It certainly is not "a sort of control flow
thing".
} So, I guess it's a doable idea; it's just going to feel
} really unnatural to a lot of people. I prefer Pascal's
} version, where it is illegal to write a<b<c at all.
} This avoids any misinterpretation.
So far so good (not that I agree with you, but it is your preference).
} On the other hand, versions of LISP allow things like
} (+ a b c d)
} and
} (< a b c d)
}
} which seems best of all. Maybe we should just give up on
} "normal" algebraic notation as a bad idea extended too far.
One is postfix and the other is infix, but they have identical meanings.
So why is one unnatural and the other best of all? Also, perhaps there
are places where algebraic notation [which, by the way, (< a b c d) is
an example of] is not the best option, but I don't think that programming
languages are such a place. Indeed, algebra is only recently becoming
the powerful tool in programming that it is in mathematics (abstract data
types, algebraic specification, and so on).
} Preston Briggs
} preston@titan.rice.edu
--
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:
<8606@batcomputer.tn.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!leah!rpi!batcomputer!laceyReferences:
<8577@batcomputer.tn.cornell.edu> <14251@haddock.ima.isc.com> <516@brazos.Rice.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.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: <8606@batcomputer.tn.cornell.edu> Date: 10 Aug 89 19:37:49 GMT References: <8577@batcomputer.tn.cornell.edu> <14251@haddock.ima.isc.com> <516@brazos.Rice.edu> Reply-To: lacey@tcgould.tn.cornell.edu (John Lacey) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 54