Argument Passing (Magic xpa 3.x)
When, at runtime, Magic xpa performs a Call Task, Program, or Exp operation in the program flow, it copies the current values of the variables listed in the Arguments list of the current task into the corresponding variables, defined as either Parameter or Virtual type variables.
When a parameter is defined in the called program or task, arguments will be sent to Parameter type variables in sequential order. In this case, any Virtual variables will be ignored. If no parameter is set in the called task or program, arguments will be passed to Virtual variables.
The receiving variables of the called task contain a copy of the information passed from the calling task. These variables can be used for any purpose in the called task: form display or user input.
Upon termination of the called task, the Virtual or Parameter variables used to receive passed arguments are copied back to all of the calling task’s list of variables. There is no backtracking to variables that use an expression for passing data in the called task. Hence, all passed arguments that are variables reflect any changes to their counterpart called task Virtual or Parameter variables. This has the effect of what is usually called argument passing by reference. All of the passed Expression operation values are one-way only, which means that the values are used in the called task, but any changes made in the called task are not returned to the calling task. This has the effect of argument passing by value.
Because argument variables receive back any changes to corresponding variables in the called task, a recomputation of Init and Link expressions may occur in the calling task, according to the rules defined in the local variables and Link operation descriptions. Changing a value in a called task means changing it by end-user input or by an Update operation. If the changed argument variable is displayed on the screen, its display will be refreshed as soon as the called task returns to the calling task.