|
![](/i/fill.gif) |
In article <3bdad6fb@news.povray.org> , "Rune" <run### [at] mobilixnet dk>
wrote:
> 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?
You still did not understand which means I am not able to explain it well
enough :-(
What you are assuming is that function variables have a scope within the
parser like #declared variables have. But they do not have any scope at
all! They are not part of the parser and its #declared variables. If they
had a scope in the context of the parser as you expect them to have (because
otherwise the #declared values could not be "hidden" inside functions) the
example I gave would be valid, but it is not and cannot be valid without
changing the fundamentals of what functions are (it would make them to
macros). Let me try a different example (based on some other discussion
that took place in this groups recently). It shows a problem the change you
are asking for would create (unless it would be made illegal). I hope it
illustrates the problem of adding function parameters to any parser level
scope:
#declare foo = function(a,b,c)
{
a +
#declare b = 5;
c + b // What is 'b' now assuming either model of operation???
}
Currently the answer is: 'b' will be substituted by '5'
You ask for: It should either remain 'b' or be an error. Neither makes
sense to me. I hope neither makes sense to you and it
explains the problem with adding a scope for function
parameters to the parser.
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |