comp.lang.ada
 help / color / mirror / Atom feed
* Empty Bounded Containers
@ 2014-05-23  0:20 sbelmont700
  2014-05-23  1:05 ` Adam Beneschan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: sbelmont700 @ 2014-05-23  0:20 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-05-27 20:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-23  0:20 Empty Bounded Containers sbelmont700
2014-05-23  1:05 ` 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

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