POV-Ray : Newsgroups : povray.text.scene-files : foreach macro : Re: foreach macro Server Time
15 May 2021 20:33:47 EDT (-0400)
  Re: foreach macro  
From: jr
Date: 28 Apr 2021 10:25:00
Message: <web.60896fa7d564bfd479819d986cde94f1@news.povray.org>
hi,

William F Pokorny <ano### [at] anonymousorg> wrote:
> Played a few minutes with this just now and you can get your original
> code to run if you change the tail m_l10 macro to:
>
> #macro m_l10(i_,n_)
>    #debug concat("----------> level 10, n = ",str(n_,0,0),".\n")
>    #fopen FID "parse_fore.tmp" write
>    #write (FID,"#---\n")
>    #fclose FID
> #end
>
> Though by the time it finishes it's consumed 1.6G or more of memory
> after maybe five minutes. My wild guess is all those Parse_String(s) end
> up sitting in memory until parsing is finished. In other words I think
> at the end we have unrolled more or less the whole recursion.
>
> Parse_String is involved in what's happening, but it's not clear to me,
> why - some scope issue maybe as it comes after the last "call" to m_l10.

all v strange.  my hunch is that Parse_String is involved indirectly only.  the
exact naming seems to matter, so I wonder what happens when 'm_l10' gets
inserted in the symbol table (cf TOK's error message).  the level of nesting --
thinking of calling it "voluntary recursion" :-) -- is not the problem I think,
attached a scene that nests/recurses to 19 levels, no problems (except time +
memory consumption ;-))  will try and find a little time in next days to play
with different naming "schemes".


regards, jr.


Post a reply to this message


Attachments:
Download 'n19tst.pov.txt' (3 KB)

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