POV-Ray : Newsgroups : povray.programming : Fuctions : Re: Fuctions Server Time
28 Jul 2024 14:21:55 EDT (-0400)
  Re: Fuctions  
From: David
Date: 24 Jul 2000 17:35:41
Message: <B5A20496.1935%davidmccabe@mac.com>
Well, for one, a fuction can return a var. Perhaps you can return with a
marco, but I don't know how...
Functions can have templates. Hmmm...what else...fuctions can be used for
overloading. The list goes on.

> From: Chris Huff <chr### [at] maccom>
> Newsgroups: povray.programming
> Date: Mon, 24 Jul 2000 13:27:11 -0500
> Subject: Re: Fuctions
> 
> In article <B5A119EF.1928%dav### [at] maccom>, David
> <dav### [at] maccom> wrote:
> 
>> I think in the next version of POV (eg 4), there should be real
>> functions, not macros.
> 
> Why? Functions would be much more restricting than macros, and not any
> more useful.
> Don't forget that the current macros don't behave exactly like C
> macros...for example, the parameters are actual variables, not bits of
> text that are cut and pasted into the body. The body *is* copy-pasted,
> which allows a macro to do and generate anything, without needing a
> single return type.
> 
> Anyway, isosurface functions already use the "function" keyword. :-)
> I think it might be worth it to have these functions be available to
> ordinary calls, like this:
> #declare myFunc = function (A=0, B=1){sin(A)*cos(B)}
> 
> #declare Val = myFunc(2, 1.6);
> #declare Val2 = myFunc(3);
> #declare Val3 = myFunc();
> 
> This would be most useful if functions could have different numbers of
> parameters, not just 3. The above declaration would have 2 parameters, x
> and y, defaulting to 0 and 1. The default parameter list would be (x, y,
> z), so this would be backward compatible with all existing functions.
> And while they would be restricted to scalar values, they would probably
> parse faster than macros.
> 
> -- 
> Christopher James Huff - Personal e-mail: chr### [at] maccom
> TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
> Personal Web page: http://homepage.mac.com/chrishuff/
> TAG Web page: http://tag.povray.org/


Post a reply to this message

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