comp.lang.ada
 help / color / mirror / Atom feed
* Unknown constraints and type composition
@ 2018-06-14 15:37 Alejandro R. Mosteo
  2018-06-14 16:19 ` Dmitry A. Kazakov
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Alejandro R. Mosteo @ 2018-06-14 15:37 UTC (permalink / raw)


I think I have read somewhere that types with unknown constraints are a 
good way of ensuring you (or your users) don't end with uninitialized values:

types Whatever (<>) is [limited] private;

function Create return Whatever;

This seems nice at first sight but when these types have any likelihood 
of ending as members of another type you will hit the "unconstrained 
member" problem.

A workaround then is to use a Indefinite_Holder, but that's an imposition 
on your clients (ugly). If your type is furthermore limited, then you 
must use pointers and consider providing controlledness and deallocation 
in the enclosing type (uglier).

Right now I'm on the point of a new design where I have many interrelated 
types that require initialization calls (it's a C binding). And, as 
always, I'm unsure of the way to go, or if I'm missing another technique 
without shortcomings. Your thoughts if you have any on this issue are 
much appreciated.

Alex.

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

end of thread, other threads:[~2018-07-08 13:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 15:37 Unknown constraints and type composition Alejandro R. Mosteo
2018-06-14 16:19 ` Dmitry A. Kazakov
2018-06-14 16:58 ` sbelmont700
2018-06-14 17:53 ` Jeffrey R. Carter
2018-06-15  5:13   ` J-P. Rosen
2018-06-15  9:34     ` Alejandro R. Mosteo
2018-07-08 13:53     ` Jacob Sparre Andersen
2018-06-14 21:28 ` Randy Brukardt
2018-06-15  9:37 ` Alejandro R. Mosteo

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