dsr@hector.UUCP (David S. Rosenblum) (12/01/88)
In article <10906@ulysses.homer.nj.att.com> dsr@hector.UUCP (David S. Rosenblum) BLEW it!: | |In order to enforce this [evenness] constraint |consistently in the manner of Ada, I would want to do the following: | |(1) Overload := so that it raises CONSTRAINT_ERROR when given an odd | right-hand-side. |(2) Overload the attributes 'SUCC and 'PRED so that they skip odd values. |(3) Overload the attributes 'POS and 'VAL so that count only even values. |(4) Overload the attribute 'FIRST so that it returns the smallest even | value of EVEN's base type. |(5) Overload the attribute 'LAST so that it returns the largest even | value of EVEN's base type. |(6) Overload the membership tests and the ".." token so that only | even ranges are considered. |(7) Overload the indexing operation for all array types I define that are | indexed by EVEN values, so that even-numbered components are stored and | accessed contiguously. |(8) Overload the aggregate operation for such array types so that | the index values for the aggregate are computed "the right way". | |Yet after all these exertions, my evenness constraint would STILL not |be enforced consistently, unless I was given several more language changes. |For example, type conversions, qualifications, attribute evaluations and |membership tests never propagate exceptions. Oops, type conversions and qualifications CAN propagate exceptions, so add the following to the above list: (9) Overload type conversion on EVEN so that CONSTRAINT_ERROR will be raised by an attempt to convert an odd value. (10) Overload qualification on EVEN so that CONSTRAINT_ERROR will be raised by an attempt to qualify an odd value. The rest of my message stands as written. ------------------------------------------------------------------- David Rosenblum UUCP: {ucbvax, decvax}!ulysses!dsr AT&T Bell Laboratories ARPA: dsr@ulysses.att.com 600 Mountain Ave. dsr%ulysses@att.arpa Murray Hill, NJ 07974-2070 (201) 582-2906 -------------------------------------------------------------------