evaluation

A Builtin Command is any of the commands listed under "commands". All builtin commands start with '/'. All builtins have a return value, usually nonzero for success and 0 for failure.

A Macro Command is a user-defined command. Macro commands also start with '/'. The return value of a macro is the return value of its body when executed.

If a macro and builtin have the same name, e.g., "foo", the command "/foo" will call the macro. You can always execute the builtin with the command "/@foo".

A Simple Command is any command that does not start with '/'. The text of such a command is sent directly to the current world, if there is one. The return value of a simple command is 1 if the text is successfully sent to the current world, otherwise 0.

A Compound Command is one of /IF.../ENDIF or /WHILE.../DONE. These are described under separate help sections. Their return value is that of the last command executed.

A List is a sequence of commands separated by "%;" tokens. The return value of a List is the return value of the last command executed in the body. An empty List has a return value of 1.

Some characters within a macro body undergo substitution. These special characters are not interpreted as themselves, but cause some evaluation to be performed, and the result substituted in place of these characters. This is described under "substitution".

When an expansion begins, a new scope is created. A local variable created during the expansion will be placed in this new scope. The scope and all variables in it are destoyed when the expansion exits.

Any variable reference will refer to the variable with that name in the nearest enclosing (i.e., most recently created) still existing scope. This is called "dynamic scope".

Lexical scope can be simulated to some extent by using variable substitutions with the correct number of '%'s instead of variable references. (Remember, a "reference" uses the name by itself in an expression, like "/test foo"; a "substitution" uses '%' characters, like "/test %foo").

See: commands, macros, substitution, /if, /while


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997 Ken Keys