comp.lang.ada
 help / color / mirror / Atom feed
From: sbelmont700@gmail.com
Subject: Empty Bounded Containers
Date: Thu, 22 May 2014 17:20:51 -0700 (PDT)
Date: 2014-05-22T17:20:51-07:00	[thread overview]
Message-ID: <cfe5082c-9b50-4c5b-afe1-8dd6ea1640b9@googlegroups.com> (raw)


Hi,

In the sundry Ada distributions I have around, the "empty" bounded containers are fully defined as having a capacity of zero, e.g.

Empty_Vector : constant Vector := (Capacity => 0, others => <>);

which is not intuitively what I would assume.  For instance, the following line:

x : BC.Vector (Capacity => 42) := BC.Empty_Vector;

implies an container with a capacity of 42 initialized to a length of zero, but it of course throws a constraint error.  In fact, there really doesn't seem to be any valid use of the Empty_Vector (et al), since the actual capacity is hidden in the private part.  The LRM just says it should be the same between the two without addressing the discriminant, which isn't much help.  

Moreover, the wording seems to legally contradict itself, since by stating "If an object of type Vector is not otherwise initialized, it is initialized to the same value as Empty_Vector" it would seem to imply that 

x : BC.Vector (Capacity => 42);

ought to use the values from the Empty_Container, causing the same error, leaving no actual way to ever have any bounded containers at all.

Does anyone know what the intention actually is?

-sb


             reply	other threads:[~2014-05-23  0:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  0:20 sbelmont700 [this message]
2014-05-23  1:05 ` Empty Bounded Containers Adam Beneschan
2014-05-27 14:50   ` Adam Beneschan
2014-05-27 20:59     ` sbelmont700
2014-05-23  6:00 ` Simon Wright
2014-05-23 15:37   ` Adam Beneschan
2014-05-23 17:54     ` Simon Wright
2014-05-23 21:45 ` Randy Brukardt
replies disabled

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