POV-Ray : Newsgroups : povray.beta-test : Buglist 22 Apr 2002 (RC2) : Re: Buglist 22 Apr 2002 (RC2) Server Time
29 Jul 2024 20:24:00 EDT (-0400)
  Re: Buglist 22 Apr 2002 (RC2)  
From: Thorsten Froehlich
Date: 5 May 2002 13:39:13
Message: <3cd56e41@news.povray.org>
In article <Xns### [at] 204213191226> , che### [at] sympaticoca
(Coridon Henshaw) wrote:

>> Having the same name twice in the same namespace simply cannot work.
>
> Please tell that to the RC3 binary.  It copes just fine with #declared/
> #localed names that match macro parameters:
>
> #local X = function(x,y,z) {x+y+z}
> #macro A(X) #end

But that is a completely different case!  X is known to be a variable in both
cases and the variable namespace is well-defined.

> Given that there's no valid reason to use the output of a macro to
> determine the name of another macro's parameters,

You would be surprised what one can do (also the above can't be done) inside
macro parameter lists...

> not performing macro
> expansion during this portion of parsing seems reasonable for consistancy's
> sake alone.  For instance, why should the code above work when #macro X()
> #end #macro A(X) #end doesn't?

Because macros are in a completely different namespace.  In particular are
#macros behaving like macros and not functions (see <http://www.povray.org/
working-docs/id000153.html#6_2_8_3>) here.

As you know, #locals have a scope that is limited to files or the current
block while #macros are in a global namespace not really shareable with
#declares.  As POV-Ray identifiers are typeless there is significantly more
ambiguity when parsing such constructs.

As for the actual problem, by disallowing #declares (and anything that
implicitly declares an identifier) in parameter lists of #macro definitions
one can allow #macro identifiers as parameter names.  Nevertheless, this might
break some old scenes...

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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