Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Clarification of SIMD objects vs values #338

@stoklund

Description

@stoklund

The spec text talks about SIMD objects and SIMD values, where a SIMD object is an object with an internal [[SIMDData]] slot holding a SIMD value. The section about the SIMD constructor prototype talks about a [[SIMDWrapperData]] slot. I assume that is that same thing?

Consider this code:

x = SIMD.Int32x4(1,2,3,4);
y = Object(x);
typeof y;                // "object"
y.toString();            // "SIMD.Int32x4(1, 2, 3, 4)".
typeof x;                // "int32x4"
x.toString();            // TypeError!

The last line will throw a TypeError because the SIMD.Int32x4.prototype.toString method requires a SIMD object. I wonder if that is intentional?

Compare to the Symbol.prototype.toString method which accepts both a symbol value and an object wrapping a symbol.

Something similar is going on with the valueOf and toLocaleString methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions