%defctx creates a new context

Use %defctx to create a namespace or context which contains groups of macros.

The first parameter is the name of the context you want to define.

There is an optional second argument, which is the parent context which you want to "inherit" from. All inheritance is dynamic, so changes to the parent context will affect all children.

The optional third argument is SMX code you want to run. After you define a context "test" using %define(test,%set(x,4)) then expanding %test(%x%) or would return '4'. The "body" argument can be any SMX code. Only the function definitions and variable assignments are stored in the context, however.

If want to specify the optional body, but do not want to inherit from a parent context, then make sure to leave the second argument blank.

Be careful with commas when making long macros. If you want a comma to show up in the
body, remember to put the body in quotes : ",", or curly braces {...}, or to excape your commas: \,. Smx tries
to figure out what you meant, but these really help.


    ,%define(walk,%name% walks.)




bob walks.

See Also