ulocal - luxembourg/muxcode-clm GitHub Wiki
ULOCAL() (continued)
Examples: > &FRUIT me=apples bananas oranges pears > &SUB-FUNCTION me=[setq(0,v(FRUIT))][extract(%q0,match(%q0,%0),1)] > &TOP-FUNCTION me=[setq(0,are delicious!)][ulocal(SUB-FUNCTION,%0)] %q0 > say u(TOP-FUNCTION,b*) You say, "bananas are delicious!"
If SUB-FUNCTION had been called with u() instead of ulocal(): > &TOP-FUNCTION me=[setq(0,are delicious!)][u(SUB-FUNCTION,%0)] %q0 > say u(TOP-FUNCTION,b*) You say, "bananas apples bananas oranges pears"
In this second example, in SUB-FUNCTION, %q0 was set to "apples bananas oranges pears", so that when the u() "returned" and TOP-FUNCTION evaluated %q0, this is what was printed. In the first example, ulocal() reset the value of %q0 to its original "are delicious!"
makes ulocal() particularly useful for global or shared code which calls arbitrary u() functions, where global register values need to be preserved from accidental user clobbering.
Related Topics: ulocal2