|
![](/i/fill.gif) |
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] mac com>
> Newsgroups: povray.programming
> Date: Mon, 24 Jul 2000 13:27:11 -0500
> Subject: Re: Fuctions
>
> In article <B5A119EF.1928%dav### [at] mac com>, David
> <dav### [at] mac com> 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] mac com
> TAG(Technical Assistance Group) e-mail: chr### [at] tag povray org
> Personal Web page: http://homepage.mac.com/chrishuff/
> TAG Web page: http://tag.povray.org/
Post a reply to this message
|
![](/i/fill.gif) |