Some Typed Objects Confusion

David Herman dherman at mozilla.com
Tue Aug 20 16:12:59 PDT 2013


On Aug 20, 2013, at 1:31 PM, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:

> [In this page](http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects), and in the latest meeting note too, I can read both uint8 and Uint8, as example.

Bug. Fixed, thanks.

> **The Question**
> How is `new StructType({x:Uint32, y:Uint32})` supposes to understand the type? `instanceof Uint32` or `typeof v === "uint32"` or ... both in case of `boolean` and `string` ?

Neither. It tells you that the x and y fields have typeof 'number' and that their values are constrained to be integers in the range [0, 2^32).

> A bonus question would be: does anybody know when this stuff is planned to go out? Not a single beta/alpha channel is exposing anything at all so far.

Nikhil Marathe and Niko Matsakis are actively working on the implementation for SpiderMonkey:

    https://bugzilla.mozilla.org/show_bug.cgi?id=578700

Dmitriy Lomov is actively working on updating the prollyfill to match the current API:

    https://github.com/dherman/structs.js
    https://github.com/dherman/structs.js/pull/12

Not sure if anyone on the V8 team (which includes Dmitriy) has started implementation but I believe they're interested. Right now Dmitriy is focused on the prollyfill and spec.

Dave



More information about the es-discuss mailing list