Please enable JavaScript to view this site.

A-Shell Development History

Compiler language enhancement, edit 905: new compiler functional directive .EXTERN(expr), when used within a function or procedure, changes the normal scope search rules (first local, then module, then global) for the enclosed variable or expression, to consider only global variables.

For example:

map1 state$,S,20,"Ignorance"

...

Function Fn'Foo() as i4

    map1 state$,S,.sizeof(.extern(state$))  ! S,20

    state$ = "Bliss"                        ! assign local state$

    print .extern(state$);" is ";state$     ! Ignorance is Bliss

EndFunction

 

In the above function, there are references to two variables named state$: one local to the function and one global. Normally, the scope rules would give the local variable precedence, even if ++pragma auto_extern or an explicit ++extern state$ directive was specified. The use of the .extern() functional directive allows the function to selectively and explicitly refer to the global version of the variable.