POV-Ray : Newsgroups : povray.advanced-users : ?: Server Time
28 Jul 2024 16:21:17 EDT (-0400)
  ?: (Message 1 to 6 of 6)  
From: Andrew the Orchid
Subject: ?:
Date: 24 Feb 2005 16:35:11
Message: <421e488f$1@news.povray.org>
It appears that A?B:C doesn't work inside functions - but select() does. 
Is this documented somewhere? (I presume this is the reason that both 
constructs exist in the first place...?)


Post a reply to this message

From: Warp
Subject: Re: ?:
Date: 24 Feb 2005 18:04:28
Message: <421e5d7b@news.povray.org>
Andrew the Orchid <voi### [at] devnull> wrote:
> It appears that A?B:C doesn't work inside functions - but select() does. 
> Is this documented somewhere? (I presume this is the reason that both 
> constructs exist in the first place...?)

  Well, is the ?: operator listed as valid operator in user-defined
functions?

  While it might not be very clear from the documentation (it should
perhaps be), the SDL and the user-defined functions are basically two
completely different and independent languages. They somewhat resemble
each other, but the user-defined functions are basically a language
inside the SDL, not SDL itself. They are even interpreted at
completely different levels. For this reason not everything that
works in the SDL works in the user-defined functions.
  You can create the body of a user-defined function using SDL, but
that's just kind of user-defined function metaprogramming, that is,
a program (in a different language) which creates a program (in the
other language).

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: ABX
Subject: Re: ?:
Date: 25 Feb 2005 04:20:31
Message: <qoqt11l2o96i0tc6uls8dfmn58glungs2q@4ax.com>
On Thu, 24 Feb 2005 21:33:37 +0000, Andrew the Orchid <voi### [at] devnull> wrote:
> It appears that A?B:C doesn't work inside functions - but select() does. 
> Is this documented somewhere? (I presume this is the reason that both 
> constructs exist in the first place...?)

http://www.povray.org/documentation/view/3.6.1/506/

A?B:C is part of FULL_EXPRESSION which is part of NUMERIC_EXPRESSION

If you would compare it with:
http://www.povray.org/documentation/view/3.6.1/509/
none of the is part of USER_FUNCTION specs.

ABX


Post a reply to this message

From: Andrew the Orchid
Subject: Re: ?:
Date: 28 Feb 2005 16:15:20
Message: <422389e8$1@news.povray.org>
> http://www.povray.org/documentation/view/3.6.1/506/
> 
> A?B:C is part of FULL_EXPRESSION which is part of NUMERIC_EXPRESSION
> 
> If you would compare it with:
> http://www.povray.org/documentation/view/3.6.1/509/
> none of the is part of USER_FUNCTION specs.

Ouch... man, I shouldn't have asked! :-/


Post a reply to this message

From: Andrew the Orchid
Subject: Re: ?:
Date: 28 Feb 2005 16:24:46
Message: <42238c1e$1@news.povray.org>
>   While it might not be very clear from the documentation (it should
> perhaps be), the SDL and the user-defined functions are basically two
> completely different and independent languages. They somewhat resemble
> each other, but the user-defined functions are basically a language
> inside the SDL, not SDL itself. They are even interpreted at
> completely different levels. For this reason not everything that
> works in the SDL works in the user-defined functions.
>   You can create the body of a user-defined function using SDL, but
> that's just kind of user-defined function metaprogramming, that is,
> a program (in a different language) which creates a program (in the
> other language).

Yeah - directives execute at parse time, functions execute at runtime.

I think in this case it's more a question of it not being immediately 
obviouse that one construct belongs to one set, and the other belongs to 
another... (I only checked the function reference)


Post a reply to this message

From: Warp
Subject: Re: ?:
Date: 1 Mar 2005 05:41:02
Message: <422446be@news.povray.org>
Andrew the Orchid <voi### [at] devnull> wrote:
> Yeah - directives execute at parse time, functions execute at runtime.

  Functions can be used at parse time as well, but it's a completely
different engine which runs them (the SDL parser just calls this
function VM).

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

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