Version 1.2 of ais/ai-00191.txt
!standard 03.03 (04) 97-08-19 AI95-00191/00
!class ramification 97-08-19
!status received 97-08-19
!priority Low
!difficulty Easy
!subject Are formal parameters passed by reference objects or views?
!summary
!question
Are formal parameters passed by reference objects or views?
3.3(2 & 4) state:
All of the following are objects:
a formal parameter of a subprogram, entry, or generic subprogram;
but 6.2(2) & 6.4.1(10) contradict this in stating:
When a parameter is passed by reference, the formal parameter denotes
(a view of) the object denoted by the actual parameter; ...
For a formal parameter (of any mode) that is passed by reference (see 6.2),
a view conversion of the actual parameter to the nominal subtype of the
formal parameter is evaluated, and the formal parameter denotes that
conversion.
Which is correct?
!response
!appendix
!section 3.3(4)
!subject An OBJECTive View
!reference RM95-3.3(4), 6.2(2), 6.4.1(10)
!from Dan Lehman 97-05-08
!keywords object, formal parameter, view
!reference 1997-15750.a Dan Lehman 1997-5-8>>
!discussion
RM95-3.3(2 & 4) state:
All of the following are objects:
a formal parameter of a subprogram, entry, or generic subprogram;
but RM95-6.2(2) & 6.4.1(10) contradict this in stating:
When a parameter is passed by reference, the formal parameter denotes
(a view of) the object denoted by the actual parameter; ...
For a formal parameter (of any mode) that is passed by reference (see 6.2),
a view conversion of the actual parameter to the nominal subtype of the
formal parameter is evaluated, and the formal parameter denotes that
conversion.
-----------------------------------------------------------------------------
Appendix
>>> From lehman@ida.org Mon Jul 10 23:17:36 1995
In an aside on this FRN, I asked Bob how the overriding body with the
one abstract (and one not) parameter could be called, given 3.9.3(1):
| > B> The overriding body, however, could be called ...
| >
|D> What happens then, when in elaboration an attempt to create an object
|D> of an abstract type (formal parameter) is made? --Program_Error?
|
|We have a non-abstract subprogram one of whose parameters is of an
|abstract type. The subprogram is not primitive of that abstract type.
|How can you call it?
|
|You can't create an object of an abstract type. But you can create a
|view of an object, and the view can be of the abstract type. Create an
|object of some descendant of the abstract type. Use type conversion to
|create a view whose type is the abstract type, and pass that to the
|subprogram. Why you would want to do this, I don't know.
|
|Note that formal parameters of a tagged type are not objects in their
|own right; they are just views. 6.4.1(10).
Since 3.3(4) gives a somewhat different view, one might object. [sorry]
Should this have an AI-ish note of explanation--to qualify 3.3(4) to mean
"... formal parameter that is passed by copy ..."?
---Dan
------- *
-----------------------------------------------------------------------------
>>> From bobduff@world.std.com Tue Jul 11 15:08:14 1995
> Since 3.3(4) gives a somewhat different view, one might object. [sorry]
:-)
> Should this have an AI-ish note of explanation--to qualify 3.3(4) to mean
> "... formal parameter that is passed by copy ..."?
Yeah, I guess so.
- Bob
==============================================================================
****************************************************************
Questions? Ask the ACAA Technical Agent