Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!hub!eiffel!bertrand From: bertrand@eiffel.UUCP (Bertrand Meyer) Newsgroups: comp.lang.eiffel Subject: Re: a < b < c Summary: Why not? Message-ID: <192@eiffel.UUCP> Date: 27 Aug 89 22:05:02 GMT References: <182@enea.se> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 24 From article <182@enea.se>, sommar@enea.se (Erland Sommarskog): > [...] The rule for a relational expression should be something like: > Rel_exp ::= Expression (Rel_op Expression)* > [...] The semantic interpretation would be than of a logical AND so that: > a < b <= c > a + 2 > would be a shorthand for > a < b AND b <= c AND c > a + 2 > [...] Since Eiffel still is open for changes for some more time, > why not take the chance and add it? Not an essential thing, > but one of those little things that makes life easier. Or > is there some problem I have overlooked? I have tried to find an argument for not following Mr. Sommarskog's suggestion and I cannot think of one. As a matter of fact, many assertions in the basic Data Structure Library and elsewhere would be written more simply in this way. It may be that the reason why no mainstream language has included the form suggested by Mr. Sommarskog is that people feared ambiguity. But the simple semantics he suggests (``and'') makes any such fear unfounded. At first (and second) sight this seems to be the kind of extension that only has advantages. It should find its way into version 3. -- Bertrand Meyer bertrand@eiffel.com