Skip to content

Implementation selection #37

@TitanNano

Description

@TitanNano

I read the proposal a couple of times now, but I'm still failing to see who implementation selection is going to work.

Let's say I create my own ToString protocol:

Protocol ToString {
    symbol;

    toString() {
       return this[ToString.symbol];
    } 
}

const myObject = {
    [ToString.symbol]: 'myObject',
};

console.log(myObject.toString());

How is the implementation of .toString() being selected? Will this run Object.prototype.toString() or ToString.toString()?

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