POV-Ray : Newsgroups : povray.general : A painful lesson regarding function arguments. u=x, v=y. : Re: A painful lesson regarding function arguments. u=3Dx, v=3Dy. Server Time
18 Oct 2021 15:50:28 EDT (-0400)
  Re: A painful lesson regarding function arguments. u=3Dx, v=3Dy.  
From: William F Pokorny
Date: 29 Sep 2021 18:41:52
Message: <6154ebb0$1@news.povray.org>
On 9/29/21 5:25 PM, Bill Pragnell wrote:
> This behaviour is kind-of warned about in the docs:
> 
> http://www.povray.org/documentation/3.7.0/r3_3.html#r3_3_1_8_3
> 
> ....although I must admit I didn't know this before your post, and I only
> stumbled on that doc entry because I happened to be doing something with
> functions recently too. One to remember!
> 
> Bill (the other P)
> 

Hi Bill :-). Thanks for pointing it out. I'm glad there is some warning 
in the documentation. And I note there are two types of argument traps 
to remember there - and not just the one into which I fell!


//--- Duplicate arguments are ignored. (povr branch only)
#include "functions.inc"
#declare Fn00 = function (a,b,c,a,b,c) {f_boom(a,b,c,0,0,0)}
#declare Fn01 = Fn00(1,2,3,4,5,6);
#error "Parse test. Stop early."
//---

Generates:
----------

Possible Parse Error:

f_boom
1(x) -> 1,
2(y) -> 2,
3(z) -> 3,
4(0) -> 0,
5(1) -> 0,
6(2) -> 0

Fatal error in parser: Uncategorized error.

//--- u,v synonyms for x,y. Last spec wins. (povr branch only)
#include "functions.inc"
#declare Fn00 = function (x,y,z,u,v,a) { f_boom(x,y,z,u,v,a) }
#declare Fn01 = Fn00(1,2,3,4,5,6);

#error "Parse test. Stop early."
//---

Generates:
----------
Possible Parse Error:

f_boom
1(x) -> 4,
2(y) -> 5,
3(z) -> 3,
4(0) -> 4,
5(1) -> 5,
6(2) -> 6

Fatal error in parser: Uncategorized error.


I think it'd be better to flag these argument issues as a problems 
during parsing, but I'm not sure at the moment how to do it.

Bill P.


Post a reply to this message

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