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 but it could also
be here: https://github.com/nikomatsakis/typed-objects-explainer.

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

--lars

On Sun, Jul 2, 2017 at 6:53 AM, J Decker <[email protected]> wrote:

>
> On Sun, Jul 2, 2017 at 6:50 AM, Isiah Meadows <[email protected]>
> wrote:
>
>> I'm not sure this belongs in the spec.
>
>
> Typed arrays are in the spec....
> http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects
>
>
>> There exists a similar thing on
>> npm [1] which deals with Buffers instead, but you could adapt it
>> similarly to work with ArrayBuffers (via a DataView). In reality, this
>> really only would have two uses: native C interop (in Node/etc.) and
>> WebAssembly interop (which is better addressed by separate
>> `foo_create` and `foo_destroy` exports with raw pointers and creating
>> a JS wrapper to manage them more idiomatically).
>>
>> [1]: https://www.npmjs.com/package/ref-struct
>> -----
>>
>> Isiah Meadows
>> [email protected]
>>
>> Looking for web consulting? Or a new website?
>> Send me an email and we can get started.
>> www.isiahmeadows.com
>>
>>
>> On Sun, Jul 2, 2017 at 9:42 AM, J Decker <[email protected]> wrote:
>> >
>> > I would like to open a discussion to propose that an extension to
>> > http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects
>> > should be defined that would allow defintiion of interleaved typed data.
>> >
>> > Support for interleaved vertex data is one use...
>> >
>> > https://developer.apple.com/library/content/documentation/3D
>> Drawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWo
>> rkingwithVertexData/TechniquesforWorkingwithVertexData.html
>> >  section Use Interleaved Vertex Data
>> >
>> >
>> > https://www.khronos.org/opengl/wiki/Vertex_Specification
>> > Defines how OpenGL describes interleaved data.
>> >
>> > This could also be used to interop with native code as an array of
>> packed
>> > (C) structs.
>> >
>> > I don't really know what the definition mechanics might be, but for
>> usage I
>> > might like to see...
>> >
>> > var arr = new InterleavedTypeArray( [ { name: "fieldName",
>> type:"uint32' },
>> > ... probably an array of objects defining the fields in an element ],
>> > <element count> );
>> >
>> > arr[x].fieldName = value.
>> >
>> >
>> >
>> > _______________________________________________
>> > es-discuss mailing list
>> > [email protected]
>> > https://mail.mozilla.org/listinfo/es-discuss
>> >
>>
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to