On 07/02/2017 11:20 AM, Lars Hansen wrote:
On Sun, Jul 2, 2017 at 9:12 AM, J Decker <[email protected] <mailto:[email protected]>> wrote:



    On Sun, Jul 2, 2017 at 8:25 AM, Lars Hansen <[email protected]
    <mailto:[email protected]>> wrote:

        The TypedObjects proposal does this, for what it calls
        non-opaque types (you can define types and then map them onto
        an ArrayBuffer in various ways).  I'm not 100% sure what the
        latest text is, I expect it is here:
        https://github.com/tschneidereit/typed-objects-explainer
        <https://github.com/tschneidereit/typed-objects-explainer> but
        it could also be here:
        https://github.com/nikomatsakis/typed-objects-explainer
        <https://github.com/nikomatsakis/typed-objects-explainer>.

    That's about a single structure; as is the thing Isiah suggested
    (ref-struct) and not an array of packed structures such as would
    be used for interleaved vertex data.


​No, the TypedObjects proposal allows for packed arrays of structures, without references. See https://github.com/tschneidereit/typed-objects-explainer/blob/master/core.md#struct-arrays.

--lars​

        TypedObjects is currently a stalled proposal.  I expect it may
        be revived when WebAssembly integration into JS becomes a more
        seriously discussed topic.


TypedObjects are exactly what you want for this sort of use case, and are really quite nice. I'm no expert, but TypedArrays probably ought to be subsumed by the TypedObject spec since AFAICT they are a proper subset of TypedObject arrays, at least for practical purposes.

Spidermonkey has had them implemented since sometime in 2013, though we haven't used them much and the constructors are of course not exposed to the Web. (And the implementation of TypedArrays is still separate, and has better JIT support.) They're really quite nice when you have the sorts of problems they're meant for. For other problems, I would guess they would be quite an attractive nuisance. ;-)

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to