An experiment using an object literal based class definition pattern

Andreas Rossberg rossberg at
Mon Aug 8 03:39:32 PDT 2011

On 4 August 2011 22:57, Allen Wirfs-Brock <allen at> wrote:
> Using these two new ideas and other active object literal enhancement
> proposals it is pretty easy to compose a class-like declaration.  For
> example the SkinnedMesh from
> the proposal can be
> code as:
>   const SkinnedMesh = THREE.Matrix4.Mesh <| function(geometry,materials){
>     super.construtor(geometry,materials);
>     this.{
>       identity.Matrix: new THREE.Matrix4(),
>       bones: [],
>       boneMatrices: []
>     };
>   }.prototype.{
>     update(camera) {
>       ...
>       super(update);
>     }
>   }.constructor.{
>     default(){
>       return new this(THREE.defaultGeometry,THREE.defaultMaterials);
>     }
>   };

Sorry for chiming in late, but I don't understand this example. My
understanding so far was that <| takes a literal on its right-hand
side. But that doesn't seem to be the case here. So what is the
intended semantics? Does <| mutate the rhs object (that would make it
equivalent to exposing mutable __proto__, which seems bad)? Or does it
copy the object (then how is the copy defined)?

Or do you consider <| to take precedence over .{}? In that case, the
example wouldn't make sense, because <| wouldn't see the prototype


More information about the es-discuss mailing list