1

From Ada2012 Reference Manual:

arm2012.html/rm-4-1-3.html

A selected_component that is not an expanded name shall resolve to denote one of the following:

  • A view of a subprogram whose first formal parameter is of a tagged type or is an access parameter whose designated type is tagged:

Why it is significant to have it only for the first formal parameter?

Please explain with examples.

nicael
  • 18,550
  • 13
  • 57
  • 90
porton
  • 5,214
  • 11
  • 47
  • 95
  • 1
    That's how Ada implements `Object.Operation(...)` notation similar to what's available in other object-oriented languages. Ada 95 didn't have this, so if you have an object of a tagged type, and an operation defined on that type, you had to say `The_Package.Operation(Object, other-parameters)` instead of `Object.Operation(other-parameters)`. – ajb May 19 '14 at 15:58

1 Answers1

6

The definition in 4.1.3 Selected Components, 9.1/2 provides for prefixed notation, which allows one to invoke the primitive operations of a tagged type without mentioning the enclosing package explicitly. A related example is seen here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045