Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!uwvax!rutgers!caip!clyde!watmath!watnot!watdaisy!gvcormack From: gvcormack@watdaisy.UUCP (Gordon V. Cormack) Newsgroups: net.lang Subject: x < y < z using user-defined types and overloading Message-ID: <7934@watdaisy.UUCP> Date: Fri, 17-Oct-86 14:04:02 EDT Article-I.D.: watdaisy.7934 Posted: Fri Oct 17 14:04:02 1986 Date-Received: Sat, 18-Oct-86 23:48:02 EDT Distribution: net Organization: U of Waterloo, Ontario Lines: 27 There has been discussion in the net on languages that allow the notation x < y < z as a shorthand for x < y and y < z With user-defined types and overloaded operators (like in Ada) this is easy to set up (I will spare you the tedious Ada Syntax). type tempresult = record val: real tst: bool end operator "<" (a: real, b: real) bool = ... the normal comparison operator "<" (a: real, b: real) tempresult = (val => b, tst => a < b) operator "<" (a: tempresult, b: real) bool = (a.tst and a.val < b) operator "<" (a: tempresult, b: real) tempresult = (val => b, tst => a.tst and a.val < b) Aren't data types wonderful? -- Gordon V. Cormack CS Department, University of Waterloo gvcormack@watdaisy.uucp gvcormack%watdaisy@waterloo.csnet