IIAFEs?

Chris Ryan chris.ryan.det at gmail.com
Thu Jun 20 21:11:14 PDT 2013


Hi, sorry if this is tangentially related to the conversation, however I've
just got a simple question.  How would you call eval() with the ThisBinding
inside the evaluated code being a custom item?  In ES5 we'd do something
like the following:

(function () {

    eval(foo);

}).call(bar);


Would this change significantly with the advent of arrow functions and hard
lexical binding or am I not getting my head around how these are supposed
to be applied?

On 21 June 2013 04:06, Quildreen Motta <quildreen at gmail.com> wrote:

>
> On 1 June 2013 20:52, Jorge <jorge at jorgechamorro.com> wrote:
>
>> On 02/06/2013, at 01:22, Brandon Benvie wrote:
>> > On 6/1/2013 3:44 PM, Jorge wrote:
>> {
>>   block: {
>>     if (true) {
>>       break block;
>>     }
>>   }
>> }
>>
>> But then... I'm not sure this is any better than an IIFE!
>>
>>
> Anything is better than an "Immediately Invoked
> Function-silly-Expression", actually. The only reasonable use for that is
> to create a new scope in the context of a statement:
>
> void function() {
>   doSomething()
> }()
>
> Block scoping/let makes this pattern completely unecessary. As for the
> other arguments, you do not wrap a function expression in parenthesis,
> they're already expressions so there's no need for that. At any rate, the
> problem here is JavaScript's usage of statements instead of Expressions,
> Expressions Everywhere.
>
> e.g.:
>
> var x = function(){ return foo }()
>
>
>
>
> --
> --
> Quildreen "Sorella" Motta  (http://killdream.github.com/)
> *— JavaScript Alchemist / Minimalist Designer / PLT hobbyist —*
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130621/ac94d129/attachment-0001.html>


More information about the es-discuss mailing list