I have a simple syntax rule:
Welcome to Racket v5.2.1.
racket@> (define-syntax-rule (with-tables stem body ...)
[table-publication (string-append stem "_publication")]
[table-author (string-append stem "_author")]
[table-bridge-publication-author (string-append stem
[table-unique-counters (string-append stem "_unique_counters")]
Which works fine when I don't reference the environment defined by the let:
racket@> (with-tables "x" "hello")
However when I pass it an identifier corresponding to one of the variables
defined in the let:
racket@> (with-tables "x" table-author)
reference to undefined identifier: table-author
The identifier passed in doesn't seem to be part of the local let context,
but carried in a different context, or perhaps it was evaluated as an
operand. I didn't expect either of those. Can someone point me at a
description of the expected behavior, or give me a tip here on what is
happening and why.
... in Wolfram language there is a 'Hold' operator for situations like
this. Apparently inside the macro we have to do some evaluation to handle
the work of the macro, is that why the operand is evaluated?
Thanks in advance for explaining the evaluation/context model here.
Racket Developers list: