POV-Ray : Newsgroups : povray.beta-test : Function parameter bug : Re: Function parameter bug Server Time
30 Jul 2024 20:22:33 EDT (-0400)
  Re: Function parameter bug  
From: Rune
Date: 27 Oct 2001 11:47:07
Message: <3bdad6fb@news.povray.org>
"Thorsten Froehlich" wrote:
> Would you expect the scene below to work as well?

I don't ask for a change of the part between the {...} brackets, all I ask
is that the function parameters are made local to the function so they don't
conflict with existing variables.

Consider this code:

#declare A = 0.1;
#declare foo = function(A) {A*2}

Now when the parser reaches function(A) it "calls" the already declared
variable A and then generates an error.

Then consider this code:

#declare foo = function(C) {C*2}
#declare D = C;

Here C has not been already declared and thus the function can use C as a
parameter. That must mean that C is somehow being #declared by the function
when the function is parsed. But after the function has been declared the
variable C is not available anymore, as can be seen when attempting to
render the line #declare D = C;. That must mean that C is local to the
function.

All I'm asking is that functions *always* create local variables for the
parameters, no matter if existing variables exist that have the same name as
the function parameters. Wouldn't that be more logical? And would't it be
possible to implement?

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

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