Technical data
2 
Working with the Target Language
2-42
Variable Scoping
The Target Language Compiler uses a form of dynamic scoping to resolve 
references to variables. This section illustrates the process that the Target 
Language Compiler performs in determining the values of variables.
In the simplest case, to resolve a variable the Target Language Compiler 
searches the top-level RTW pool followed by the global pool. This illustration 
shows the search sequence that the Target Language Compiler uses.
Figure 2-4: Search Sequence
You can modify the search list and search sequence by using the %with 
directive. When you add a construct such as:
%with CompiledModel.system[sysidx]
...
%endwith
Global Pool
%assign a = … 
%assign b = …
…
Top-Level RTW Pool
CompiledModel {
…
}
2
1










