comp.lang.ada
 help / color / mirror / Atom feed
From: "Patrick D. Rogers" <p_rogers@hso.link.com>
Subject: Re: private type discriminants ignored?
Date: 1998/04/28
Date: 1998-04-28T00:00:00+00:00	[thread overview]
Message-ID: <354612AF.41C6@hso.link.com> (raw)
In-Reply-To: 35460201.ED1315C4@hso.link.com


Samuel T. Harris wrote:
> 
> Robert A Duff wrote:
> >
> > In article <rz84szje1ol.fsf@cs.williams.edu>,
> > Jay Sachs  <sachs@cs.williams.edu> wrote:
> > >       type Stack(Size : Integer := 100) is private;
> >
> > >...  What is the reason that the default initialization
> > >seems to be ignored in the discriminant for the private type?
> >
> > The default isn't being ignored; Size is being correctly initialized to
> > 100.  However, the mere presence of a default means that the
> > discriminant can change.  That's confusing, and is a language design
> > flaw, IMHO.  There should have been a separate keyword or some other
> > separate syntax to mean "the discrim might change".  But as it is in
> > Ada, an unconstrained variable of type Stack can later have a discrim of
> > Integer'Last, even though it defaults initially to 100.  And many
> > compilers take the (quite reasonable) attitude that implicit heap
> > allocation is evil, so they allocate the maximum possible size for these
> > things.  And in this case, that's enormous, and will typically raise
> > Storage_Error; hence the warning.
> 
> Not entirely accurate. The mere presense of the default value does
> not mean the discriminant can change. It depends on how objects
> are declared.


Sam,

Since we are in pedantic mode, :) Bob said "... unconstrained variable
...", so he is indeed entirely accurate.

:) 


--pat

Patrick Rogers




  reply	other threads:[~1998-04-28  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Es7569.4n2@world.std.com>
1998-04-24  0:00 ` private type discriminants ignored? Jay Sachs
1998-04-24  0:00   ` Joel VanLaven
     [not found]   ` <Es3A4J.Ion@world.std.com>
1998-04-28  0:00     ` Samuel T. Harris
1998-04-28  0:00       ` Patrick D. Rogers [this message]
1998-04-28  0:00         ` Samuel T. Harris
1998-04-30  0:00   ` Anonymous
     [not found]     ` <6ib6t4$63f$1@goanna.cs.rmit.edu.au>
1998-05-06  0:00       ` Robert I. Eachus
1998-05-01  0:00 ` Samuel T. Harris
     [not found] <matthew_heaney-ya023680003004981720560001@news.ni.net>
1998-05-01  0:00 ` Anonymous
replies disabled

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