On 5/23/23 00:50, Cousin Ricky wrote:
> As it turns out, POV-Ray appears to choose the latter instance.
> Arbitrarily. It could have been the other way around. It could have
> been random. Maybe it*is* random, and I just haven't done enough test
In a look at three other languages...
C/C++ (gcc/g++ 11.3.0)considers the duplicate parameter names/ids to be
an error. As does python3 (3.10.6).
The scripting languages tcl (8.6) allows the duplication and it appears
the first setting of the repeated name/id always wins.
In POV-Ray SDL I think the last setting of the parameter will always win
because POV-Ray maintains symbol tables (key -> value hash tables) so
the last time the symbol is set in the current scope is what the value
If allowing duplicate parameters, I think POV-Ray's last value wins
method more intuitive as inside macros / functions we can always update
the local variable(a). These within code body/block overrides are always
the last setting wins so it sort of makes sense the last time a
duplicated parameter name is set should win out too.
I lean toward the duplication of parameter names being an error. I think
duplicates are far more likely to cause confusion than help.
(a) excepting where languages support constant parameters/variables and
the feature used.
Post a reply to this message