comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Funny (so to say...) interaction of "not null" and Vectors?
Date: Tue, 8 Oct 2019 10:38:21 -0700 (PDT)
Date: 2019-10-08T10:38:21-07:00	[thread overview]
Message-ID: <2e07a635-8251-4fc0-8a9d-7ea8ef957749@googlegroups.com> (raw)
In-Reply-To: <qnid8r$ov3$1@dont-email.me>

On Tuesday, October 8, 2019 at 6:25:01 PM UTC+2, J-P. Rosen wrote:
> Le 08/10/2019 à 18:01, mockturtle a écrit :
> > Answering my own post...  I removed all the "not null" requirements and the exception disappeared...  So, I guess my idea makes sense.
> > 
> > Nevertheless, if you have any remark, I'll be happy to hear them.
> > 
> A container has a capacity, which consists of a number of (not yet) used
> elements, in order to decrease the number of reallocations. These extra
> elements are not initialized, which is not allowed per your "not null"
> declaration.
> 
> -- 
> J-P. Rosen
> Adalog
> 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
> Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
> http://www.adalog.fr

Would it make sense to have an aspect that requires that the formal type of a generic package allows for default initialization? (records with not null access types do not allow that)

I am thinking something like

generic
  type T is private 
    with Default_Initializable;
package Foo is 
...
end Foo;

without the Default_Initializable it would not be allowed, say, to create an array of T without explicitly initialize them. 

That would had saved me few head-scratching...  

  reply	other threads:[~2019-10-08 17:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 15:46 Funny (so to say...) interaction of "not null" and Vectors? mockturtle
2019-10-08 16:01 ` mockturtle
2019-10-08 16:24   ` J-P. Rosen
2019-10-08 17:38     ` mockturtle [this message]
2019-10-09 18:58       ` mockturtle
2019-10-08 16:21 ` Dmitry A. Kazakov
2019-10-08 17:30   ` mockturtle
replies disabled

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