<< FIXME Need to check a detail of the type system, namely whether
Vector.<T> is a subtype of Vector.<U> if T is a subtype of U and U is
not *. >>
It shouldn't be. Consider Bar <: Foo, Baz <: Foo:
let baz:Vector.<Baz> = new Vector.<Baz>();
let foo:Vector.<Foo> = baz; // allowed if Vector.<Baz> is considered a
subtype of Vector.<Foo>
foo.add(new Bar());
let bazItem:Baz = baz.get(0); // type error!
Other comments:
push() is missing "length++;"
sort() is missing "return this;"
I think that the first for loop in unshift() should read
for ( let i=1 ; i <= oldlimit ; i++ )
this[newlimit-i] = this[oldlimit-i];
also, "return newlength;" should be
length = newlimit;
return length;
assuming that the length setter only sets the length property, without
setting any default values (otherwise it would need to be moved up to
before the for loops).
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lars Hansen
Sent: Monday, March 03, 2008 12:36 PM
To: [email protected]
Subject: ES4 draft: Vector
I enclose a slightly incomplete/rough draft for the Vector class.
Please comment.
--lars
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss