POV-Ray : Newsgroups : povray.general : POV-Ray & Databases : Re: POV-Ray & Databases Server Time
2 Aug 2024 16:22:05 EDT (-0400)
  Re: POV-Ray & Databases  
From: Christopher James Huff
Date: 6 Nov 2004 13:52:41
Message: <cjameshuff-841827.13523706112004@news.povray.org>
In article <418ccc45$1@news.povray.org>,
 Florian Brucker <tor### [at] torfboldcom> wrote:

> > foo.setColorRGB(0.2, 0.6, 0.8);
> >
> > would translate to:
> > 
> > foo setColorR:0.2 G:0.6 B:0.8;
> 
> Hm. Looks strange :) I think the missing brackets make it harder to 
> read, even with this pretty simple expression. But your example looks 
> like it supports named parameters, that's a nice thing, coupled with 
> optional parameters:
> 
> #macro MyMacro(Length,Height,Width,optional Color) #end
> 
> MyMacro(Length = 10, Width = 5, Height = 3)
> MyMacro(Length = 10, Color = rgb .5, Width = 5, Height = 3)

It actually developed this way:
I'm most used to C++, so I'll do it like this:

foo.setColorRGB(0.2, 0.6, 0.8);

Hmm, named parameters would be useful, and would give a useful 
equivalent to overloading:

foo.setColor(R: 0.2, G: 0.6, B: 0.8);

You know, that part of the name outside doesn't really need to be 
divided from the part inside...

foo.(setColorR: 0.2 G: 0.6 B: 0.8);

That looks weird, and the dot isn't really needed. If I just take it out 
though, it'll look too much like a function call. Here we go...

(foo setColorR: 0.2 G: 0.6 B: 0.8);

Ah, the parentheses don't give anything to single statements, so make 
them optional.
Huh. Looks a lot like Objective C and Smalltalk.

(Actually, the last two syntaxes are both allowed in Sapphire.)

However, the method you suggested has one possible additional benefit: 
you can specify the parameters in any order. Especially useful when 
there are several default parameters...C++ requires you to specify all 
parameters up to the last one specified, this would allow you to skip 
them when the defaults are fine.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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