Version 1.2 of ais/ai-00232.txt
!standard 10.1.2 (01) 00-04-13 AI95-00232/01
!class amendment 00-04-13
!status No Action (10-0-0) 04-03-06
!status work item 00-04-13
!status received 00-04-13
!priority Low
!difficulty Hard
!subject Dispatching operation visibility and ambiguity
!summary
The rules for dispatching calls are relaxed to allow T2'Class to be passed
to a dispatching operation of an ancestor type T1. Ambiguity is allowed,
so long as all meanings are equivalent.
!problem
OPEN ISSUE: It is not clear whether this AI is a good idea. It was
identified as a problem by Erhard and his students.
!proposal
In a dispatching call on a dispatching operation of a tagged type T1 the actual
parameter for a controlling operand may be (access-to-) T2'Class, where
T2 is any descendant of T1. If this results in ambiguity between corresponding
dispatching operations of ancestors of T2, the ambiguity is permitted so long
as the actual parameters (both explicit and defaulted) are the same or
conforming expressions in the multiple possible interpretations.
!wording
!example
!discussion
This addresses a problem analogous to the "substitutability" problem
for access types (see AI-00230), but it is for dispatching calls. In Ada 95,
the current rules require that, given a controlling operand of type
(access-to-)T'Class, you must call an operation of T. Full substitutability
would allow a call on a dispatching operation of any ancestor of T. However,
this might introduce ambiguity. That is not really a problem when making a
dispatching call, since at run-time, they would all go to the same subprogram
body. The only danger is that if a parameter is defaulted, the default
expressions wouldn't match, or the formal parameter names have been changed
in a way as to make the various calls have different meanings.
!appendix
Randy Brukardt 00-04-13
This proposal was split out of the "with type" proposal (AI-00217) in
April 2000. Some early conversation on this feature can be found in that
AI's appendix.
*************************************************************
Questions? Ask the ACAA Technical Agent