Shape objects

Bob Myers rtm at gol.com
Sat Jun 16 09:30:44 UTC 2018


The engines already do these optimizations.


On Sat, Jun 16, 2018 at 1:27 PM Cyril Auburtin <cyril.auburtin at gmail.com>
wrote:

> I wish JS had Shape objects, which would not only ease performance
> optimization for the benefit of JS engines (
> https://youtu.be/5nmpokoRaZI?t=871), but also helps for validation, like
> an interface
>
> ```js
> shape Point { x: Number, y: Number, name: String };
>
> const p = Point({x: 1, y: 2, name: 'foo'})
>
> const p = Point({x: 1, y: 2, naem: 'foo'}) // throws
> ```
>
> That object would have its properties immutable
>
> I think proposal-first-class-protocols (
> https://github.com/michaelficarra/proposal-first-class-protocols/issues/27#issuecomment-386975099)
> could more or less directly do that feature
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180616/1ccfb8c6/attachment.html>


More information about the es-discuss mailing list