SED Extensions - Local procedures and functions

SED  -  Local Procedures and Functions

Top  Previous  Next

 

A single extension source record may contain local procedures and functions that are only accessible to the other components of that extension. These must follow the main procedure or function are take the form

 

LPROC name

ARGS arg1, arg2, arg3...

(

...operations...

)

 

or

 

LFUNC name

ARGS arg1, arg2, arg3...

(

...operations...

 (return result)

)

 

There is no concept of local variable scope. Variable names used within local PROCs and FUNCs refer to the same set of variables as in the main PROC or FUNC. In particular, note that the argument variables simply provide an easy way to transfer information into the local PROC or FUNC. The two alternatives below are exact equivalents.

 

PROC

(

   ...

(MYPROC 12 A)

   ...

)

 

LPROC MYPROC

ARGS X, Y

(

   ...

)

 

 

PROC

(

    ...

(SET X 12)

(SET Y A)

(MYPROC)

    ...

)

 

LPROC MYPROC

(

   

)...

 

Although local procedures may recurse (that is call themselves) it is likely that the lack of scoped variables makes this of limited use.