|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> I never realized that a macro's result-- object(FOO)-- was a global variable
> that remained 'alive' in a scene once the macro was invoked.
It has to be, since macros "spit thing out" to be used outside of the macro.
> I always thought the *entire* contents of a macro died after each use (as if
> object(FOO) was always a #local thing as well.) So in effect, the result is
> 'cached' for use later. Very interesting!
I think it depends on if you use #declare or #local.
We cover this from time to time:
http://news.povray.org/povray.newusers/message/%3Cweb.5751decd76b80bcda4b712a50%40news.povray.org%3E/#%3Cweb.5751decd76
b80bcda4b712a50%40news.povray.org%3E
I'd say probably the best way to think of a macro when dealing with variables
like this, is that it's essentially just like an include file - it's just an
encapsulated piece of code.
Calling it just re-runs the code, and if it has arguments, it just uses those
new arguments.
I think the argument names and values are the only thing that are temporary,
local, and get destroyed upon exiting.
Post a reply to this message
|
|