next up previous
Next: Access Modes of External Up: Informal Semantics of ``accesses'' Previous: Accessed and updated functions

Accessed and updated functions in External Functions

The more complicated case is given when an asm B being used as an external function in A accesses and updates functions declared in A. Due to the fact that A doesn't make any step during the run of B, rules in B updating dynamic functions declared in A are actually not performed from B's point of view. Therefore, in XASM the semantics of updated functions in external asm functions is defined in a way, that these kind of unintuitive behavior is avoided: This ensures, that all updates of an ``updates'' function are accessible in B, and that only the last updates are forwarded to the parent A. In general, the updates of functions declared in A and updated in B are treated as being part of the update set of A's current step. As a consequence, multiple invocations of B in the same step of A do not influence each other.

Consider the following - somewhat artificial - example:



\begin{asmfbox}
\ASM A \IS
\FUNCTION f(x:Int) \rightarrow Int
\FUNCTION v \rig...
...TERNAL \FUNCTION B \rightarrow Int
\ldots
v := B
\ldots
\ENDASM
\end{asmfbox}

\begin{asmfbox}
\ASM B \rightarrow Int
\USEDAS \FUNCTION
\UPDATES \FUNCTION f(...
...N
r := f(0)
f(0) := i
i:=i+1
\ELSE
\RETURN r
\ENDIF
\ENDASM
\end{asmfbox}


In each step of the run of asm B the value of the updated function f(0) is updated with a new value. The semantics of the ``updates'' declaration in XASM ensures that all updates of f are accessible in B and that only the last update of f in B is propagated to the parent asm A. In this example, the update f(0) := 2 is propagated to A, while all other updates occurring in the ``internal'' steps in B[*] have only local effects in B.[*]


next up previous
Next: Access Modes of External Up: Informal Semantics of ``accesses'' Previous: Accessed and updated functions
Philipp Kutter 2002-03-18