comp.lang.ada
 help / color / mirror / Atom feed
From: "Alejandro R. Mosteo" <alejandro@mosteo.com>
Subject: Re: Unknown constraints and type composition
Date: Fri, 15 Jun 2018 11:37:46 +0200
Date: 2018-06-15T11:37:46+02:00	[thread overview]
Message-ID: <pg01da$fpp$2@dont-email.me> (raw)
In-Reply-To: <pfu23n$csb$1@dont-email.me>

On 14/06/2018 17:37, Alejandro R. Mosteo wrote:

Thanks everyone for your comments. I think every approach was different 
and had some good food for thought. It seems things where more or less as 
I figured but seeing how different people goes about it reassures me.

Alex.

> 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.

      parent reply	other threads:[~2018-06-15  9:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
replies disabled

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