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
15 May 2024 20:43:49 EDT (-0400)
  Re: Next Generation SDL: What's wrong with Lua, JavaScript, ...  
From: clipka
Date: 12 Apr 2009 08:05:01
Message: <web.49e1d85de7a64ad834d4c3f10@news.povray.org>
"clipka" <nomail@nomail> wrote:
> > > > Sph = new Sphere( {
> > > >   radius: 1,
> > > >   position: [0,0,1]
> > > > } );
> > Can you explain your thoughts on what the problem will be with this approach?
> > Are you thinking of transformations? Method-triggering property
> > assignments ('set' methods) achieve this, e.g. a "translate: [1,0,0]" property
> > would call ".doTranslate([1,0,0])" to change the transform matrix just like the
> > current SDL parser would. As I understand it, properties are set *after* object
> > instantiation, even if they are evaluated before the instantiation.
>
> Hm, maybe then I'm mistaken indeed. I'll have to investigate that.

I just checked this, to find that what the construct will actually do is:

temp = new Object();
temp.radius = 1;
temp.position= [0,0,1];
Sph = new Sphere(temp);

This also matches what the ISO ECMAScript specification implies.

So at the point e.g. the "position" property is set, it will still use the
standard getter/setter mechanism of the basic Object type.

Furthermore, it will not act on the Sphere object at all - it will just create
yet another object that will be passed as one single parameter to the Sphere
object.


Post a reply to this message

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