arrows and a proposed softCall

Angus Croll anguscroll at gmail.com
Mon Jun 4 10:36:52 PDT 2012


On Mon, Jun 4, 2012 at 9:54 AM, Brendan Eich <brendan at mozilla.com> wrote:

> You mean you still propose that (=> 42).call({}) should throw, but
> (function () { return 42; }).call({}) should not?
>
> Sorry, this isn't a principled response. There should be no difference in
> result between those two cases.
>
>
I disagree. You yourself said "so are you looking for an isBound predicate
just to throw an error? I'm not saying that is a non-goal". The principal
is let the user know they are trying to set |this| in a hard bound
function. The level of introspection required to go the extra mile and look
for |this| usage seems neither desirable or useful. If my function doen't
reference |this| then I don't care if |this| is modifiable.

However I thought we had some agreement that -> was a valid goal. In which
case this error throwing stuff is less important (to me at least)



> Apart from principles, it seems to me you think arrows will be such sweet
> sugar that people will make mistakes using this-sensitive API contracts,
> where long-but-this-insensitve-**functions would not be so misused.
>
> To demonstrate this we need to see some evidence. It's not enough to
> worry, or to hypothesize unfixed code shipped and failing at scale due to
> failure to test arrow function misuse on the part of developers.


I'm the first to admit I have no hard evidence, only heresay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120604/24abc08b/attachment.html>


More information about the es-discuss mailing list