-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation selection #37
Comments
In your case, myObject doesn’t fully implement the protocol, so it’ll fall back to the Object.prototype method. If it did fully implement it, it’d use the ToString.toString method. |
@ljharb you are right, I forgot Protocol.implements(myObject, ToString); But what if I have two competing Protocols which both implement |
Generally speaking, there'd only be two options: to have the last one win, or to throw. I assume that rather than silently doing the wrong thing, this proposal would choose to throw, so that you couldn't mix competing protocols. If a protocol you want to use provides a toString implementation, then either you use its toString, or you don't use that protocol. |
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:How is the implementation of
.toString()
being selected? Will this runObject.prototype.toString()
orToString.toString()
?The text was updated successfully, but these errors were encountered: