Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!rex!ames!uhccux!munnari.oz.au!murtoa.cs.mu.oz.au!otc!metro!basser!usage!elecvax!cheops!marku From: marku@cheops.eecs.unsw.oz (Mark Utting) Newsgroups: comp.lang.eiffel Subject: Re: a < b < c Message-ID: <1300@cheops.eecs.unsw.oz> Date: 31 Aug 89 05:19:14 GMT References: <182@enea.se> <192@eiffel.UUCP> Organization: EE & CS, Uni N.S.W., Sydney, Australia Lines: 41 From article <192@eiffel.UUCP>, by bertrand@eiffel.UUCP (Bertrand Meyer): > 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 > ........ > > 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 I like this abbreviated notation, with one slight reservation. "a < b <= c" is fine, but "d < e > f" seems to me to be less readable than using an explicit `and'. I agree that it is not ambiguous given the above semantics, but it makes me wonder what the relationship between "d" and "f" is. When the relational operators all go in the same direction (possibly mixed with equalities), the transitive relationships all hold as well. Eg. "a" is clearly less than "c" in the above. However, when increasing and decreasing operators are mixed, this nice transitive property disappears. I guess I would like to be able to abbreviate sequences of {<,<=,=} operators, and sequences of {>,>=,=} operators, but not mix the two. The specification language Z allows any boolean relational operators to be abbreviated in this way, but published specifications seem to keep to the convention mentioned above. Mark Utting, Dept.Comp.Sci, UNSW, PO Box 1, Kensington, NSW, Australia 2033 // ACSnet,CSNET: marku@cheops.unsw.oz // BITNET/ARPA: marku%cheops.unsw.oz@uunet.uu.net \// UUCP: ...!uunet!munnari!cheops.unsw.oz!marku