>
>
> > Once again, why once a struct has been defined we need to create per each
> > instance its counterpart in native JS ?
> >
> > new Point2D({x: 1, y: 2}) ... why?
> > what's wrong with a *shimmable*
> > new Point2D(x = 1, y = 2)
> > so that no object has to be created?
>
> You'd need a benchmark that shows that the object allocation you're
> avoiding here is worth the lack of flexibility.
>
>
so, assuming JS developers will create an object per each typed instance,
you are saying that object created for the sake of creating objects are not
using double amount of memory and double effort from the GC ?

Which part lacks of flexibility ?

If named arguments + defaults could be used via apply too there won't be any
lack of flexibility ...

function sum(a = 0, b = 0) { return a + b; }

sum.apply(null, {a: 10, b: 15}); // 25

will this be allowed in JS.next ? (now call it differently from apply if you
want, it's an example)

If yes, shouldn't typed Struct accept named arguments rather than objects
for instances creations so that we can chose both ? something like ...

var p1 = Point.apply(null, {x: 0, y: 0}),
     p2 = Point(x = 0, y = 0);
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to