From: Mehdi Saada <00120260a@gmail.com>
Subject: questions on RM's section of subprograms and dispatching
Date: Fri, 23 Feb 2018 12:22:32 -0800 (PST)
Date: 2018-02-23T12:22:32-08:00 [thread overview]
Message-ID: <cc8cc793-2385-456f-b944-e70847c0c3da@googlegroups.com> (raw)
I started reading extensively the RM on subjects that were barely touched by my course, firstly because it stopped at ada95, and it didn't touch concurrent programming either. Sections by sections, I'll ask precisions on important points I couldn't understand, but felt that I should.
package P is
type I is interface;
procedure Op (X : I) is abstract;
end P;
with P;
package Q is
type T is abstract new P.I with private;
-- Op inherited here.
private
type T is abstract new P.I with null record;
procedure Op (X : T) is null;
end Q;
with Q;
package R is
type T2 is new Q.T with null record;
-- Illegal. Op inherited here, but requires overriding.
end R;
-> Is it because T2 is non-abstract and has access only to an abstract view of P ?
___________
Note that it's possible to override a concrete subprogram with an abstract one.
-> It's even compulsory, since a type derived from a tagged type is itself tagged, and tagged types with abstract primitives must be abstract, and can have only abstract primitives.
------------------------
However, if the type is a generic formal type, the sub program need not be overriden for the formal type itself (a nonabstract version will necessarily be provided by the actual type).
-> what does it mean ?? What has it do exactly with
generic
type FOO is abstract tagged private;
function BAR(BORG: in FOO) return FOO;
package PAC is .. end PAC; ?
AI05-0073-1:
...an abstract primitive subprogram shall not be declared in the private part, unless it is overriding an abstract subprogram implicitly declared in the visible part.
-> Why overriding an abstract primitive by another abstract primitive? What can changed, besides aspects, on a subprogram with the same parameters profile ? Also, can parameters subtype of an overriding primitive be widened for use in non-dispatching calls, but so that it wouldn't mess with dispatching calls ?
Others to come ! But not for this section. Had plenty of things too technical, those ones were the only one I felt would impact me or be useful in any way.
next reply other threads:[~2018-02-23 20:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-23 20:22 Mehdi Saada [this message]
2018-02-23 20:43 ` questions on RM's section of subprograms and dispatching Simon Wright
2018-02-23 20:53 ` Mehdi Saada
2018-02-23 20:59 ` Mehdi Saada
2018-02-23 21:55 ` Mehdi Saada
2018-02-23 20: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