From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6c424a2d310d290 X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Ada Generic Library (very) preliminary release Date: 1997/07/14 Message-ID: #1/1 X-Deja-AN: 256914843 References: <33C39534.E8DAC63D@elca-matrix.ch> Newsgroups: comp.lang.ada Date: 1997-07-14T00:00:00+00:00 List-Id: On 14 Jul 1997, Jon S Anthony wrote: > In article Brian Rogoff 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