comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: ObjectAda vs Gnat -- bugs
Date: 1997/05/19
Date: 1997-05-19T00:00:00+00:00	[thread overview]
Message-ID: <dewar.864017071@merv> (raw)
In-Reply-To: 01bc63a9$6e4575c0$LocalHost@xhv46.dial.pipex.com


Nick says

<<On the other hand, it seems to me to be sensible to have the compiler
'implement' enumeration literals as function calls, and then simply have it
_optimise_ the calls into immediate values (pretty near the end of the
optimisation process).

This way, you get the overloading behaviour of enumeration literals 'for
free', and without any danger of getting it wrong (a la GNAT), and you also
get the bonus of optimising genuine parameterless functions which are
defined to return an (effectively) static value into immediate values as
well. I would argue that this is an optimisation which most compilers ought
to provide, anyway (anybody disagree?).>>

Well you have to dig in to the front end of a compiler a bit more to see
why thiings are more complicated. The trouble is that enumeration literals
are different from functions in some important ways, for example, they
are static constants, and also they can be used as selectors in te
aggregate for an enumeration rep clause -- there are many other subtleties.
So if you tried to implement them this way, apart from the significant
inefficiency for large enumeration types, you would simply swap one set of
special cases for another. It would not help at all, and in fact I think
would likely make things much worse. We find that when you distort the 
RM this way, you usually live to regret it :-)





  reply	other threads:[~1997-05-19  0:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-16  0:00 ObjectAda vs Gnat -- bugs Keith Thompson
1997-05-16  0:00 ` Robert A Duff
1997-05-16  0:00   ` Robert Dewar
1997-05-18  0:00     ` Nick Roberts
1997-05-19  0:00       ` Robert Dewar [this message]
1997-05-20  0:00         ` Nick Roberts
1997-05-21  0:00           ` Robert Dewar
1997-05-23  0:00   ` Stephen Leake
1997-05-24  0:00     ` Robert A Duff
1997-05-28  0:00       ` Stephen Leake
1997-05-30  0:00         ` Robert A Duff
1997-05-30  0:00           ` Matthew Heaney
1997-05-31  0:00             ` Robert A Duff
1997-05-30  0:00         ` Samuel Mize
  -- strict thread matches above, loose matches on Subject: below --
1997-05-30  0:00 John Walker
1997-05-19  0:00 tmoran
1997-05-19  0:00 ` Jon S Anthony
1997-05-20  0:00   ` Jeff Carter
1997-05-20  0:00   ` Nick Roberts
1997-05-25  0:00     ` Tom Moran
1997-05-15  0:00 granger
1997-05-15  0:00 ` Stephen Leake
1997-05-16  0:00   ` Jon S Anthony
1997-05-16  0:00   ` Tucker Taft
1997-05-16  0:00     ` Jon S Anthony
1997-05-16  0:00       ` Robert Dewar
1997-05-17  0:00         ` Jon S Anthony
1997-05-16  0:00       ` Tom Moran
1997-05-15  0:00 ` Robert Dewar
1997-05-16  0:00   ` David L Brown
1997-05-16  0:00     ` Robert Dewar
1997-05-17  0:00       ` Tom Moran
1997-05-18  0:00         ` Jon S Anthony
1997-05-19  0:00         ` Tucker Taft
1997-05-19  0:00       ` Tom Moran
1997-05-15  0:00 ` Samuel A. Mize
1997-05-15  0:00 ` Samuel A. Mize
1997-05-16  0:00 ` Robert A Duff
1997-05-16  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