POV-Ray : Newsgroups : povray.binaries.animations : Uberpov persistent feature for animation of big scene : Re: Uberpov persistent feature for animation of big scene Server Time
19 Apr 2024 17:54:16 EDT (-0400)
  Re: Uberpov persistent feature for animation of big scene  
From: Bald Eagle
Date: 7 Jan 2018 16:10:01
Message: <web.5a528b9f6e53ffa45cafe28e0@news.povray.org>
"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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.