POV-Ray : Newsgroups : povray.binaries.scene-files : Sky simulation : Re: Sky simulation Server Time
2 May 2024 07:32:50 EDT (-0400)
  Re: Sky simulation  
From: Cousin Ricky
Date: 7 Sep 2013 17:30:00
Message: <web.522b99e159bb6361306548240@news.povray.org>
scott <sco### [at] scottcom> wrote:
> >> #local xyYtoR = function (x,y,Y){ x+y+Y }
> >
> > OOOPS!!! after trying this (its work) I have re-read my code and I've seen a Y
> > declared by me (I know, #local is better than #declare).
> > I'm a stupID!!

You are not stupid, Fractracer.  It is a design flaw in POV-Ray.

> Not your fault, no matter what variable name you choose to use there is
> always the chance someone else is using that same name elsewhere.
> Another reason to stick to x,y,z for function parameters.

If the ideal of using meaningful identifier names isn't reason enough, sticking
to x, y, and z won't help if the function has more than three arguments.  That's
why I do things like this:

   #declare RE_fn_Wheel = function (x, y, z, RE_P0_RMajor, RE_P1_rMinor)

Where "RE_" is a prefix reserved by the include file (i.e., users are instructed
not to declare any identifiers that begin with "RE_").  Cumbersome yes, but
accidents are avoided.

This happens whenever you declare an identifier and then later use that same
name as a function argument.  (I mentioned this in the p.b.i thread where a
similar issue turned up with macro names.)  Oddly, it doesn't happen if you
declare the identifier /after/ the function is defined.


Post a reply to this message

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