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
23 Feb 2024 19:13:03 EST (-0500)
  Re: Next Generation SDL: What's wrong with Lua, JavaScript, ...  
From: clipka
Date: 11 Apr 2009 20:30:00
Message: <web.49e1350ce7a64ad8dc1687770@news.povray.org>
"MessyBlob" <nomail@nomail> wrote:
>
> Doesn't JavaScript have the ability to assign properties to objects as they are
> being instantiated?, e.g.
>
> Sph = new Sphere( {
>   radius: 1,
>   position: [0,0,1]
> } );

A host of languages has this.

The problem is still the scope: However you toss and turn it, you can't just go
ahead and do some stuff in the new object's scope (or "namespace" or however
you want to call it) without some added hassle.

The problem is that all mainstream languages do initialization of an object by
passing some expressions as parameters, with the expressions being evaluated in
the scope of the calling block. Plus they're evaluated before the object is
created, so can't have side effects on the object.


Post a reply to this message

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