A new function name property proposal

Brandon Benvie brandon at brandonbenvie.com
Mon Nov 19 11:34:21 PST 2012


function x(){ x = { name: 'y' }; return x.name } x(); // 'y'

(function x(){ x = { name: 'y' }; return x.name })() // 'x'


On Mon, Nov 19, 2012 at 2:29 PM, Jorge Chamorro Bieling <
jorge at jorgechamorro.com> wrote:

> On 17/11/2012, at 18:45, Brandon Benvie wrote:
>
> > The name property doesn't currently (and the I don't propose it should)
> have a correlation to the name in scope. In function declarations the name
> is only in scope because its declared in the outer scope, and this can be
> overwritten permanently rendering the name unusable in that scope. A named
> function expression
>
> --and function declarations too--
>
> > puts the name association in a decorative scope that is untouchable and
> only accessible inside the function.
>
> It's not clear to me whether one might end with function whose name (the
> value returned by function.name) might be !== than its name as "seen"
> from inside the function itself:
>
> function ƒ () { return (ƒ.name <http://xn--3ha.name> !== 'ƒ') }
>
> ?
> --
> Jorge.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121119/3c5dc1cc/attachment.html>


More information about the es-discuss mailing list