Go to the first, previous, next, last section, table of contents.


compileTime

Control-struct: compileTime
file: job.t
package: muf
status: alpha

Algolic compilers (Algol, C, Pascal, Modula, Ada ...) are traditionally big black boxes of functionality locked away from the programmer. Lisp and Forth compilers are traditionally open frameworks which programmers are encouraged to use and extend. Muq MUF is implemented in the latter spirit.

Specifically, Forth traditionally implements the compiler using a standard architecture which is documented and open to the programmer, and provides a keyword by which the programmer may mark a particular function as being intended to run at compiletime rather than at runtime.

When the compiler encounters an invocation of such a function, it evaluates the function immediately in the context of the partly-compiled program, rather than assembling a call to invoke it at runtime. In essence, the programmer is allowed to dynamically extend the compiler.

Muq MUF defines a very different compileTime architecture (since, again, it must prevent erroneous or malicious code from crashing the interpreter), but provides essentially the same facility: Any function which contains the operator compileTime anywhere in its definition compiles into an executable procedure with a special flag set; When the MUF compiler encounters an invocation of such a procedure, it evaluates the procedure immediately at compiletime, rather than assembling a runtime call to it.

Since the compileTime architecture is not yet (version -1.0.0) stably defined, no examples of this are given here.

Note: The COMPILETIME flag is ignored by the inserver MUF compiler, which is the only compiler functional in the -1.0.0 Muq release.

Note: This operator will probably be replaced by a define-macro: operator in a future release.


Go to the first, previous, next, last section, table of contents.