comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.de>
Subject: null exclusion and generics
Date: Thu, 19 Oct 2006 14:51:59 +0200
Date: 2006-10-19T14:49:50+02:00	[thread overview]
Message-ID: <1161262319.24061.19.camel@localhost.localdomain> (raw)

If a generic formal type is private, I can supply a
null excluding subtype for the type parameter.
A generic formal private type means assignment is possible.
Declarations of objects of the null excluding
actual inside the generic need explicit initialization,
though.

generic
   type T is private;
procedure Nop(source: in T);

procedure Nop(source: in T) is
   tmp: T;  -- no known way to initialize
begin
   tmp := source;
end Nop;

Can I excpect, then, that Ada.Containers.* will typically
not be usable with null excluding subtypes? (Because an
implementation will likely declare local variables without
knowing how to initialize them.)

Is it a possible enhancement to add something like

generic
   type T is private;
   Default_Value: ...;  -- or a subprogram, or ...
...



-- Georg 





             reply	other threads:[~2006-10-19 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-19 12:51 Georg Bauhaus [this message]
2006-10-19 13:06 ` null exclusion and generics Dmitry A. Kazakov
2006-10-19 20:08 ` Randy Brukardt
2006-10-20  7:57   ` Dmitry A. Kazakov
replies disabled

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