☜ | Parameter Passing1990 Version of ANSI Standard | ☞ |
Parameter passing is a method of passing information in a controlled manner to and from a subroutine as the result of an exfunc, an exvar, or a Do command with an actuallist.
actuallist | ::= | ( [ L actual ] ) |
See section 1 for the definition of L.
actual | ::= | ┌ │ └ |
. actualname expr |
┐ │ ┘ |
See 2.3 for the definition of expr.
actualname | ::= | │ │ │ |
name @ expratom V actualname |
│ │ │ |
See 2.2.1 for the definition of name. See 2.2 for the definition of expratom. See section 1 for the definition of V.
When parameter passing occurs, the formalline designated by the labelref must contain a formallist in which the number of names is greater than or equal to the number of actuals in the actuallist. The correspondence between actual and formallist name is defined such that the first actual in the actuallist corresponds to the first name in the formallist, the second actual corresponds to the second formallist name, etc. Similarly, the correspondence between the parameter list entries, as defined below, and the actual or formallist names is also by position in left-to-right order. If the syntax of actual is .actualname, then it is said that the actual is of call-by-reference format; otherwise, it is said that the actual is of the call-by-value format.
When parameter passing occurs, the following steps are executed:
As a result of these steps, two (or more) NAME-TABLE entries may point to the same DATA-CELL. As long as this common linkage is in effect, a Set or Kill of an lvn with one of the names appears to perform an implicit Set or Kill of an lvn with the other name(s). Note that a Kill does not undo this linkage of multiple names to the same DATA-CELL, although subsequent parameter passing or New commands may.
Execution is then initiated at the first command following the ls of the line specified by the labelref. Execution of the subroutine continues until an eor or a Quit is executed that is not within the scope of a subsequently executed doargument, xargument, exfunc, exvar, or For. In the case of an exfunc or exvar, the subroutine must be terminated by a Quit with an argument.
At the time of the Quit, the formallist names are unbound and the original variable environment is restored. See 2.6.15 for a discussion of the semantics of the Quit operation.
Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.
This page most recently updated on 13-Sep-2014, 09:20:37.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)