From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Class-wide types algebra
Date: Mon, 12 Sep 2016 22:26:19 +0200
Date: 2016-09-12T22:26:19+02:00 [thread overview]
Message-ID: <nr731d$h8g$1@gioia.aioe.org> (raw)
Presently class-wide types are singletons. I would propose to extend
that to call-wide expressions, namely conjunction in all places where
T'Class is expected. e.g.
procedure Foo (X : in out T'Class and R'Class); -- Not Ada
task type Worker (X : not null access T'Class and R'Class) is
if X is in (T'Class and R'Class) then
Object : T'Class and R'Class renames (T'Class and R'Class) (X);
It should not be difficult, at first glance.
Rationale. Presently it is impossible to declare an operation requiring
an instance derived from the type T that also implements interface R. We
cannot do that without having a explicit root type
type T_And_R is new T and R with ...;
But that will exclude existing types already implementing T. If we
already have:
type S is new T with ...;
A type derived from S with R added would not fall into T_And_R.
Generics do not help much because descendants of T may have
discriminants which are all unknown in advance, so there is no chance to
create instances derived types.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next reply other threads:[~2016-09-12 20:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 20:26 Dmitry A. Kazakov [this message]
2016-09-12 21:12 ` Class-wide types algebra rieachus
2016-09-12 21:39 ` Dmitry A. Kazakov
2016-09-13 11:46 ` rieachus
2016-09-13 12:26 ` Dmitry A. Kazakov
2016-09-28 0:05 ` Randy Brukardt
2016-09-28 7:31 ` Dmitry A. Kazakov
2016-09-28 20:17 ` Randy Brukardt
2016-09-29 8:06 ` Dmitry A. Kazakov
2016-09-29 18:44 ` Randy Brukardt
2016-09-29 19:55 ` Dmitry A. Kazakov
2016-10-01 5:47 ` Randy Brukardt
2016-10-01 8:35 ` Dmitry A. Kazakov
2016-10-05 20:42 ` 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