|
|
In article <39A30BD5.5E049847@club-internet.fr>, Francois Dispot
<woz### [at] club-internetfr> wrote:
> Being able to call finctions would be great, and would also suppress the
> need for texture or pigment evaluation...
Do you mean using eval_pattern() or eval_pigment() to extract the value?
This makes it possible to evaluate functions in the current version, but
would break with variable numbers of parameters.
> About the "if" function, it could also be possible to have something
> like the well-known cryptic a?b:c syntax.
Why? Like you said, it is cryptic. I personally avoid it like goto or
the plague. :-)
> Adding local variables and loops would probably make things quite
> different. Could you elaborate on a possible syntax? Did you think about
> some lisp-like or RPN (a la PostScript) method?
The syntax would be very similar to ordinary POV, and in ways more
similar to C...I don't know what Lisp is like, and definitely not RPN(if
you mean Reverse Polish Notation, I don't know PostScript either). Just
something like this:
#declare MyFunc =
function (V, Oct, A){
var Ctr = 0;
var O = 0;
var Result = 0;
if(Oct <= 0)
O = 1;
else
O = Oct;
endif// or maybe use {} blocks
while(Ctr < O)
Result += sin(O*V);
newVal += 1;
endwhile
Result/O
// or
return A*(Result/O);
};
#declare Value = MyFunc(clock, 4, 1.4);
I really am not sure about the return syntax...the first one would
maintain compatibility with existing functions, but might make the
parser harder to write(and it looks funny if you are used to programming
in C). Maybe the return value should be the first expression not
preceded by an expression which is using it, and not followed by =, +=,
-=, --, or ++. So if the parser encounters an equation is just sitting
there alone, not being used as input to if(), while(), or anything, or a
variable which is not being modified, it would be used as the return
value.
And maybe it should use #if(), #while(), etc. for consistency with the
rest of the language.
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|