Skip to content

Some options changes the definition of thenable #5

@mhofman

Description

@mhofman

The discussion during plenary made me realize that options 2 & 3 basically change the definition of what a thenable is for native promises, as it effectively excludes some objects with a callable then property, resulting in these objects to become the fulfillment value.

While I don't think the Promises/A+ spec explicitly defines a fulfillment value as being non-thenable, its Promise Resolution Procedure clearly state that values provided to a then's onFulfilled handler are recursively resolved, making it impossible for such values to become a fulfillment value of a spec compliant promise. Aka a "thenable" can misbehave and result in a thenable value fulfillment, but a spec compliant promise implementation must paper over that and not adopt that state.

As such I do not believe these approaches to be acceptable. By contrast, option 1, making Object.prototype exotic, does not cause that issue as it prevents plain objects from becoming thenable in the first place.

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