When you asked about discussion and this ran into my mind :)
I remember it was discussed here
http://esdiscuss.org/topic/protocol-library-as-alternative-to-refinements-russell-leggett,
( the syntax in
https://gist.github.com/genericallyloud/7086380 )
Do the semantics proposed above work with what's proposed there?
The "using the function as an extension method" seems pretty similar.
However , Russell's work proposes a form of polymorphic dispatch based on
the extended type. For example:
```js
let dmot = new DoingMyOwnThing("Bob");
dmot::map( n => n * 3;) // calls method `map` of the DoingMyOwnThing
class instead of using the protocol method
```
This is really useful behavior that solves a few very real problems for me
(it's real extension methods) - I think it would be very beneficial for
discussions about bind syntax to allow or at least consider this.
Thanks,
Benjamin
On Thu, Feb 13, 2014 at 10:33 PM, Kevin Smith <[email protected]> wrote:
>
>> What about protocols?
>>>
>>>
>> Can you elaborate? I know that Russell Leggett did some work along those
>> lines a while ago (which really inspired the merge idea), but can you
>> describe exactly what you mean?
>>
>>
> Note though, that since behavior of `referenceGet` is completely
> arbitrary, you could (for instance) create a "reference name" object which
> traverses up the prototype chain looking for a certain method name, and
> returns some fallback method if nothing is found.
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss