Next: , Previous: $DO, Up: Built-in functions


7.2.3.14 $DUMPDEF: Dump macro definitions to the terminal

In the call ‘$DUMPDEF(m1, m2, ...)’, m1, m2, and so on are macro calls (with arguments if appropriate). Two lines of output are generated for each argument. Line 1 is the macro definition; line 2 is its expansion using the provided arguments.

One can use this built-in to debug one's own macros, or to find out the secrets of Fweb's built-ins. As an example, if one says

     $DUMPDEF($EVAL(2^^4))@%

it responds with the two lines

     $EVAL($0) = $$EVAL($0)
     $EVAL(2**4) = 16

(The $n notation indicates the n-th argument of the macro.) If one replaces $EVAL with $$EVAL in the above $DUMPDEF, it will respond

     $$EVAL($0) = <built-in>
     $$EVAL(2**4) = 16

The purpose of code such as ‘$EVAL($0) = $$EVAL($0)’ is to ensure that the argument of $EVAL is expanded if it contains macros; the primitive function $$EVAL does not do that expansion automatically.

Names indicated as ‘<built-in>’ by $DUMPDEF may be redefined as ordinary macros, but this is in general a very bad idea; other parts of Fweb may mysteriously stop working.