Version of ais/ai-00196.txt

Unformatted version of ais/ai-00196.txt version
Other versions for file ais/ai-00196.txt

!standard 03.09.02 (17)          98-03-27 AI95-00196/00
!class binding interpretation 98-03-27
!status received 98-03-27
!priority Low
!difficulty Easy
!subject assignment and tag-indeterminate calls with controlling results
!summary 98-03-27
!question 98-03-27
!recommendation 98-03-27
!wording 98-03-27
!discussion 98-03-27

!section 3.9.2(17)
!subject      assignment and tag-indeterminate calls with controlling results
!reference  RM95-3.9.2(17-19)
!reference  RM95-5.2(9)
!from       Dan Rittersdorf 97-09-15
!keywords   controlling tag, assignment, controlling result, no controlling operand
!reference 1997-15785.a Dan Rittersdorf 1997-9-15>>

   Before addressing the assignment issue, my example begs another question.

   The language of 3.9.2(17), in the context of the preceding paragraphs,
   makes it unclear that the definition of "controlling tag value" applies
   to a primitive function having controlling operands.

   It can be presumed that 3.9.2(17) was intended to mean:

      "If all of the controlling operands (if any) are tag-indeterminate,..."

   Without this clause applying to calls having no controlling operands,
   the "controlling tag value" would be left undefined for such calls.
   The lack of language specific to the case of a function having no
   controlling operands is conspicuous because it is explicitly mentioned in
   many other places in the same chapter.  The immediately preceding
   paragraphs discuss only functions having one or more controlling
   operands, and the working of 3.9.2(17) leads one to think that functions
   having no controlling operands are somehow left out of the definition
   of "controlling tag value".

   Regardless of whether 3.9.2(17) includes calls to functions having
   no controlling operands, but having a controlling result, it appears that
   3.9.2(19) is at odds with 5.2(9).

   To be honest, the matter of a call to a primitive function having no
   controlling operands isn't relevant to the contradiction of 3.9.2(19)
   and 5.2(9).  The problem arises with any assignment whose expression
   is a call to a function having a tag-indeterminate controlling result.

   Consider the following:

         package p1 is
            type t is tagged null record ;
            function func return t ;                  -- (1)
         end p1 ;

         with p1 ;
         package p2 is
            use p1 ;
            type e is new t with null record ;
            function func return e ;                  -- (2)
         end p2 ;

         with p1 ;
         with p2 ;
         procedure bummer_dude is
            eee : p2.e ;

            procedure crash_and_burn (formal : in p1.t'class) is
               local : p1.t'class := formal ;
               local := p1.func ;                     -- (3)
            end crash_and_burn ;
            crash_and_burn (eee) ;                    -- (4)
         end bummer_dude ;

   The tag-indeterminate call to func at (3) is in question.  I am going
   to presume that 3.9.2(17) applies to func, but if it doesn't, I'm sure
   you can imagine that the call involves a function that has a
   tag-indeterminate controlling operand, and the problem remains.
   For the call at (4), what is the body that will execute when the call
   at (3) is made?  3.9.2(19) says it is p1.func (declared at (1)),
   and 5.2(9) says that it is p2.func (declared at (2)).

   3.9.2(19) says that the controlling tag for the call is statically
   determined to be p1.t'tag, because the call is not a controlling operand
   of another call, and p1.func is a dispatching operation of type p1.t.

   However, 5.2(9) contradicts this.  The target (local) is class-wide,
   and the expression (call to p1.func) is tag-indeterminate, so the
   controlling tag is taken from the tag of local, which is p2.e'tag.

   This dilemma arises when the expression of an assignment statement is a
   call on a function with a tag-indeterminate controlling result.
   How is this dilemma reconciled?


--        or    
  Concurrent Computer Corporation      |               Daniel G. Rittersdorf
  2101 W. Cypress Creek Rd.            |               178 Washington Street
  Ft. Lauderdale FL 33309              |               Sparta, MI 49345-1324
  Ph: +1 (954) 974-1700                |               Ph: +1 (616) 887-5431


Questions? Ask the ACAA Technical Agent