comp.lang.ada
 help / color / mirror / Atom feed
From: agate!howland.reston.ans.net!noc.near.net!inmet!bobduff@ucbvax.Berkeley.E DU  (Bob Duff)
Subject: Re: thoughts on "holey" enumerated types
Date: 12 Sep 93 20:13:51 GMT	[thread overview]
Message-ID: <BOBDUFF93Sep12.161351@dsd.inmet> (raw)

> 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

             reply	other threads:[~1993-09-12 20:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-12 20:13 agate!howland.reston.ans.net!noc.near.net!inmet!bobduff [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-13 15:33 thoughts on "holey" enumerated types David Emery
1993-09-13 14:24 john r strohm
1993-09-12 21:51 Michael Feldman
1993-09-12 21:45 Michael Feldman
1993-09-12 18:02 agate!howland.reston.ans.net!usc!cs.utexas.edu!csc.ti.com!tilde.csc.ti.co
1993-09-11 23:23 cs.utexas.edu!utnut!utcsri!csri.toronto.edu!blaak
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox