comp.lang.ada
 help / color / mirror / Atom feed
From: "Stanley R. Allen" <s_allen@hso.link.com>
Subject: Re: Beware: Rep spec on an enumeration type causes code explosion
Date: 1997/12/10
Date: 1997-12-10T00:00:00+00:00	[thread overview]
Message-ID: <348F3238.4487@hso.link.com> (raw)
In-Reply-To: EKxx9n.Ly1.0.-s@inmet.camb.inmet.com


Tucker Taft wrote:

> 
> Although the ability to specify the representation of an enumeration
> type initially sounds perfectly reasonable, the fundamental problem is that
> Ada also allows such "holey" enumeration types to be used as the
> type for a for-loop index, an array index, an entry family index,
> or the 'Succ/'Pred attributes.  This results in surprising implicit
> inefficiencies, something that violates one of the general Ada
> language design principles.

I find it hard to believe that the efficiency of this
is *implictly* bad.  It seems like the use of holey enum
types for for-loop ranges, array-indexes, etc, would
always default to the use of positions; only placing
the enum value into a location should cause a table
look-up (one index redirection) for the actual value.

> 
> So in retrospect, I believe enumeration representation
> clauses in Ada are a mistake.  If a user wants to name
> particular values, they should simply use named integer
> constants, or perhaps better, named private-type constants.  They can build
> up various maps of their own if they want to translate to/from some kind
> of "holey" representation from/to a contiguous representation.
> 

But then you lose the 'Image function, 'Range, array
index, etc., which is why you wanted the Enum type to 
begin with!  (I understand that I can simulate some of
this.)

I'm not surprised to hear Tucker say this, however, since
he has complained publicly before that "those chapter 13
features end up being 50% of your compiler!"; I'm sure
compiler developers would like some relief from having to
expend so much effort on those aspects.

-- 
Stanley Allen
mailto:s_allen@hso.link.com




  parent reply	other threads:[~1997-12-10  0:00 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-05  0:00 Beware: Rep spec on an enumeration type causes code explosion Joe Gwinn
1997-12-06  0:00 ` Robert Dewar
1997-12-06  0:00 ` Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-06  0:00 ` Kevin D. Heatwole
     [not found]   ` <dewar.881478386@merv>
1997-12-07  0:00     ` Robert Dewar
1997-12-09  0:00   ` Jim Gleason
1997-12-06  0:00 ` Tucker Taft
1997-12-06  0:00   ` Robert Dewar
1997-12-06  0:00   ` Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-08  0:00     ` Mats Weber
1997-12-09  0:00     ` Tucker Taft
1997-12-09  0:00       ` Matthew Heaney
1997-12-10  0:00         ` Charles Hixson
1997-12-10  0:00       ` Jean-Pierre Rosen
1997-12-10  0:00       ` Robert Dewar
1997-12-10  0:00       ` Stanley R. Allen [this message]
1997-12-14  0:00         ` Robert Dewar
1997-12-10  0:00       ` Stephen Leake
1997-12-14  0:00         ` Robert Dewar
1997-12-10  0:00       ` Ken Garlington
1997-12-11  0:00         ` John G. Volan
1997-12-11  0:00           ` Ken Garlington
1997-12-12  0:00             ` Matthew Heaney
1997-12-12  0:00               ` Ken Garlington
1997-12-16  0:00                 ` John G. Volan
1997-12-17  0:00                   ` Ken Garlington
1997-12-12  0:00           ` Joe Gwinn
1997-12-12  0:00             ` Robert Dewar
1997-12-16  0:00             ` John G. Volan
1997-12-17  0:00               ` Joe Gwinn
1997-12-17  0:00                 ` John G. Volan
1997-12-18  0:00                   ` Joe Gwinn
1997-12-17  0:00               ` Ken Garlington
1997-12-12  0:00           ` Alan E & Carmel J Brain
1997-12-12  0:00             ` Robert Dewar
1997-12-15  0:00               ` Tucker Taft
1997-12-16  0:00                 ` Brian Rogoff
1997-12-11  0:00       ` Rakesh Malhotra
1997-12-11  0:00         ` Matthew Heaney
1997-12-12  0:00           ` Rakesh Malhotra
1997-12-12  0:00           ` Samuel Tardieu
1997-12-12  0:00             ` Robert Dewar
1997-12-12  0:00           ` Robert Dewar
1997-12-14  0:00         ` Alan E & Carmel J Brain
1997-12-12  0:00       ` Joe Gwinn
1997-12-15  0:00         ` Robert Dewar
1997-12-16  0:00           ` Joe Gwinn
1997-12-16  0:00             ` Robert Dewar
1997-12-09  0:00     ` Geert Bosch
1997-12-10  0:00       ` Robert Dewar
1997-12-06  0:00 ` David Marshall
1997-12-06  0:00 ` Robert Dewar
1997-12-06  0:00   ` Matthew Heaney
1997-12-10  0:00   ` GNORT information ( Was Re: Beware: Rep spec on an enumeration type causes code explosion ) Mark Bennison
1997-12-10  0:00     ` Robert Dewar
1997-12-06  0:00 ` Beware: Rep spec on an enumeration type causes code explosion Corey Minyard
1997-12-08  0:00   ` Joe Gwinn
1997-12-10  0:00     ` Robert Dewar
1997-12-06  0:00 ` Ken Garlington
1997-12-06  0:00 ` Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-09  0:00     ` Stanley R. Allen
1997-12-06  0:00 ` Robert Dewar
1997-12-07  0:00 ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1997-12-09  0:00 tmoran
1997-12-11  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-12-11  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-12-11  0:00 ` Robert Dewar
replies disabled

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