comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shellx.best.com>
Subject: Re: Ada Generic Library (very) preliminary release
Date: 1997/07/14
Date: 1997-07-14T00:00:00+00:00	[thread overview]
Message-ID: <Pine.SGI.3.95.970714200338.5186B-100000@shellx.best.com> (raw)
In-Reply-To: JSA.97Jul14131434@alexandria.organon.com


On 14 Jul 1997, Jon S Anthony wrote:
> In article <Pine.SGI.3.95.970713193310.25027A-100000@shellx.best.com> Brian Rogoff <bpr@shellx.best.com> writes:
> 
> > child package of the generic container). The problem is that I can't 
> > instantiate those signature packages in the spec unless everything it needs 
> > is public, which is rather blecherous (for Ada). So a typical Iterators 
> > child package looks like this:
> > 
> > generic
> > package AGL.Some_Container.Iterators is 
> >     type Iterator_Type is 
> >         ... public type declaration, ugly ...
> > 
> >     ... Start(), Finish(), Increment(), etc ...
> > 
> >     ... other package decls ...
> > 
> >     package Bidirectional_Iterators is
> >       new AGL.Bidirectional_Iterators(Value_Type,
> >                                       Value_Ref_Type,
> >                                       Iterator_Type,
> 
> What was the design rationale for not allowing/wanting Iterator_Type
> to be a reference type (to a private Iterator_Struct_Type)?

I wanted my Iterator_Type to be stack-allocatable, and have value
semantics. If I make an Iterator_Record_Type, and have Iterator_Type 
be a reference to it, I lose all that. Since the containers themselves 
are usually access types, my largest Iterator_Type is just a record 
with an access type and an integer offset. As an aside, the "Allocators" 
of the STL are the part I am least comfortable with. 

What you have in mind would obviously allow the iterator record declaration
to be hidden. I think it is rather unfortunate that Ada doesn't allow
interleaved public and private parts of the package spec. Was anything
like that considered during the 9X revision process?  It seems to fit OK
with the "essence of Ada" as I see it, and would certainly make what I'm 
trying to do now a lot prettier. Most of the workarounds I have considered 
seem awfully ugly.

-- Brian






  reply	other threads:[~1997-07-14  0:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-08  0:00 Ada Generic Library (very) preliminary release Brian Rogoff
1997-07-09  0:00 ` Richard Kenner
1997-07-09  0:00   ` Robert Dewar
1997-07-09  0:00   ` Brian Rogoff
1997-07-09  0:00 ` Mats Weber
1997-07-09  0:00   ` Brian Rogoff
1997-07-13  0:00     ` Matthew Heaney
1997-07-13  0:00       ` Brian Rogoff
1997-07-13  0:00         ` Matthew Heaney
1997-07-13  0:00           ` Brian Rogoff
1997-07-14  0:00             ` Jon S Anthony
1997-07-14  0:00               ` Brian Rogoff [this message]
1997-07-14  0:00         ` Jon S Anthony
replies disabled

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