arrow function syntax simplified

Kevin Smith khs4473 at gmail.com
Sun Apr 8 08:52:50 PDT 2012


>
> Any legacy utility (3rd party or otherwise) that assumes its function
> arguments are dynamically bound (a reasonable assumption as of ES 5.1) will
> be in trouble when passed hard-bound fat arrow functions. Here's a gist
> illustrating a simplified version of a functional mixin process and how it
> would break under the current fat arrow proposal.
>
> https://gist.github.com/2266911
>
>
I don't see anything that is broken by arrow functions.  You are attempting
to use arrows for defining methods which is incorrect.  This would be
correct:

    function withCircleUtils() {
        this.{
          area() { return this.radius * this.raduis * Math.PI; },
          diameter() { return this.radius + this.radius; }
        };
    }

Do you see a problem with this construction?

kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120408/a2b7f5f3/attachment-0001.html>


More information about the es-discuss mailing list