|
|
Tim Attwood wrote:
>> How can it be wrong when his macro is not returning anything ?
>> (Note that he is using #local instead of #declare.)
>
> 2.2.2.8.5 explains it a bit, if an identifier is passed to a
> macro then that identifier is in scope and #local will
> modify that identifier's value.
>
> The return-by-parameter bug is more apparent in loops,
> sometimes the modified value of a parameter isn't returned,
> but that's less than 1% of the time, and it's fixed in 3.7 :-)
>
> Try this test code to convince yourself that #local in
> a macro can modify a parameter value.
>
> #macro TEST(A)
> #local A = A + 1;
> #end
>
> #declare B = 1;
>
> TEST(B)
...
Your code above may work, but was it meant to work that way ?
I.e. Is the behaviour above a bug - or is it a feature ?
:)
To me it is illogical that a #local statement should be
able to change _anything_ outside its scope.
Do you have any references to documentation, discussions
(or source code) that _clearly_ shows that one may use a
#local assignment to return a value by a parameter passed
to a macro ?
Section 2.2.2.8.5 in the manual shows #declare used to
change a given parameter in a macro.
--
Tor Olav
http://subcube.com
Post a reply to this message
|
|