|
|
Am 03.03.2016 um 00:15 schrieb Anthony D. Baye:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 01.03.2016 um 23:08 schrieb Le_Forgeron:
>>
>>> ab-using code like
>>> #write( .... #write( ...
>>> is a call for lightning from Zeus and the opening of the multidimensional portal
for Chtulhu.
>>
>> Actually - no. There's no abuse in there /per se/. The nested `#write`
>> might be part of a macro invocation, such as in:
>>
>> #write(File,SomeMacro())
>>
> That sounds like a break in scoping rules. It's not like the code is just
> dropped inline as it is with c macros, though that's how it works with the
> result.
Actually that's /exactly/ what it's like: Invoking a macro simply makes
the parser jump to the macro body, continue its parsing job there until
it reaches the `#` of the macro's `#end`, and then jump back to the
place where it left off.
The following, for instance, is perfectly legal:
#macro CloseParenthesis()
(
#end
#macro CloseParenthesis()
)
#end
#write OpenParenthesis() File, ... CloseParenthesis()
Virtually the only thing you can't "drop in" with a macro are unbalanced
block directives (anything that ultimately requires an `#end`, because
these would interfere with the way a macro's end is marked), `#local`
directives (because macros open a new context for local variables) and,
IIRC, macro definitions (because nesting macro definitions is simply
forbidden).
Post a reply to this message
|
|