POV-Ray : Newsgroups : povray.pov4.discussion.general : Next Generation SDL: What's wrong with Lua, JavaScript, ... : Re: Next Generation SDL: What's wrong with Lua, JavaScript, ... Server Time
14 Apr 2024 21:51:53 EDT (-0400)
  Re: Next Generation SDL: What's wrong with Lua, JavaScript, ...  
From: Jaap Frank
Date: 13 Apr 2009 05:57:09
Message: <49e30c75@news.povray.org>
"clipka" <nomail@nomail> schreef in bericht 
news:web.49e29a91e7a64ad8d037e2230@news.povray.org...
>
> And I'm still waiting for someone to show me a language that provides a 
> useful
> shorthand notation for:
>
> var MyObject = new Object();
> MyObject.radius = 1;
> MyObject.translation.append([0,0,1]);
> MyObject.add(new Texture(...));
> MyObject.translation.append([0,2,0]);
>

What about something like this:

@type FunnySphere = sphere{
    pos  <1.56, 2.34, 1.67> = @FirstTrans
    rad  3.245
    scale  <2.03, 0.02, 4.58>
    trans  <1.00,  0.0, 2.00>
    trans  <0.0  ,  4.5,  0.0 > = @SecTrans;
    tex {........
            trans (FirstTrans + SecTrans)
          }
    }

I'm using the @ as shorthand for #local or #declare.
The difference lies in

@SecTrans= <0.0  ,  4.5,  0.0 >;

meaning: declare it for later use, so don't use it at this moment and

<0.0  ,  4.5,  0.0 > = @SecTrans;

meaning: use it now, but declare it for later use as well.
I think that the scope of FirstTrans and SecTrans should be inside this 
type-declaration only.

Because it may be possible with POV4 to create a new kind of object, the 
word "type" indicates the creation of some kind of new object. Maybe we 
don't need "@type", but I like it for its clarity.

Jaap Frank


Post a reply to this message

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