From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 12 Sep 93 20:13:51 GMT From: agate!howland.reston.ans.net!noc.near.net!inmet!bobduff@ucbvax.Berkeley.E DU (Bob Duff) Subject: Re: thoughts on "holey" enumerated types Message-ID: List-Id: > The thread on converting integers to a sparse enumerated type has got > me thinking. > > Couldn't enumerated types always be implemented as a contiguous range, such > that use clauses to specify member ``positions'' just affected the 'POS and > 'VAL functions? You mean "representation clauses" not "use clauses". The 'Pos and 'Val attributes are not affected by an enumeration_representation_clause. The clause affects the internal representations, not the position numbers. The only effect is on the internal representation, which can only be noticed by a program that does Unchecked_Conversion, or interface to other languages, etc. > That way enumerated type operations (especially loop traversal over a range, > or array indexing) can always be efficient. The only time one needs to know a > member's position is when converting to an integer. Using 'POS and 'VAL seems > safer than unchecked_conversion in these cases anyway. But 'Pos and 'Val do something different than Unchecked_Conversion. > Ray > blaak@csri.toronto.edu - Bob Duff Ada 9X Mapping/Revision Team