On Thu, Mar 29, 2012 at 15:34, David Herman <[email protected]> wrote:
> On Mar 28, 2012, at 2:19 PM, Erik Arvidsson wrote:
>
>> With your proposal I have to do let f = obj.foo;
>> obj::f which is even longer than the original.
>
> That's not a fair argument. There's no need for the let-binding; you can write
>
>    obj::obj.foo

I'm not sure I follow? Replace obj with an arbitrary expression and it
becomes evident that a let binding is needed

>    ::obj.foo

I guess this one would work but I find it a bit strange to have this
as prefix operator.

::object.foo.bar().baz

which is the same as

do {
  let tmp = object.foo.bar();
  tmp::tmp.baz
}

> Now, you might feel that it's more intuitive for the latter form to be 
> expressed with an infix operator. I'm sympathetic to that. But my operator is 
> more expressive, because it can also express .call, which Alex's ! operator 
> can't:
>
>    o1::o2.foo(x, y, z) ~= o2.foo.call(o1, x, y, z)

That is pretty nice but I think we covered the two most common uses by
introducing super and spread already

> I would love to have built-in syntax for doing all three ABC methods 
> (.apply/.bind/.call), so that's what I find appealing about the :: syntax. 
> It's nice conservation of special forms that :: in conjunction with ... can 
> accommodate all three. But perhaps we should explore two separate new forms.
>
>> Another important, but orthogonal part of his proposal was to have
>> obj!meth === obj!meth
>
> I'm not sure I have an opinion about this part yet. Can you explain the 
> rationale?

The classic use case that everyone runs into is
addEventListener/removeEventListener.

eventTarget.addEventListener(type, this.handleFoo.bind(this));
...
eventTarget.removeEventListener(type, this.handleFoo.bind(this));  // OOPS

-- 
erik
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to