-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Description
The current proposal defines an implemented by syntax for protocols to include implementations for certain existing classes:
protocol Foldable {
// ...
implemented by Array {
foldr (f, memo) {
// implementation elided
}
}
}Is this MVP, given this can already be done via Protocol.implement()?
protocol Foldable {
// ...
}
Array.prototype[Foldable.foldr] = function foldr (f, memo) {
// implementation elided
};
Protocol.implement(Array, Foldable);How common is the use case of implementing protocols on built-ins, inline? Is it worth having dedicated syntax sugar, this early?