Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8009

Re: calling function within (function() {...})();

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!news.belwue.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <1932703.nKmheAe9J7@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Organization PointedEars Software (PES)
Date Fri, 04 Nov 2011 21:24:01 +0100
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
Subject Re: calling function within (function() {...})();
Newsgroups comp.lang.javascript
References <j-mdnaRhWZiHRS7TnZ2dnUVZ_uednZ2d@westnet.com.au> <j90o0s$vmv$1@dont-email.me> <m21utoav44.fsf@nntp.bednarz.nl> <8928443.SEqChMirdb@PointedEars.de> <m2wrbfaoiv.fsf@nntp.bednarz.nl> <2999240.SPkdTlGXAF@PointedEars.de> <m2pqh71w4b.fsf@nntp.bednarz.nl>
Followup-To comp.lang.javascript
MIME-Version 1.0
Lines 27
NNTP-Posting-Date 04 Nov 2011 21:24:01 CET
NNTP-Posting-Host 5556eb3c.newsspool4.arcor-online.net
X-Trace DXC=ckWD1IcM52B2jYf>V4L0gL4IUK<Cl32<A4Fo<]lROoRA8kF<OcfhCOKQce:MKiA0>EDZm8W4\YJNL;?f@h5gMfbL>@dMN77i@HALG:^n6c@S@E
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:8009

Followups directed to: comp.lang.javascript

Show key headers only | View raw


Eric Bednarz wrote:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> Eric Bednarz wrote:
>>>>> window.setTimeout(x.a, 0);
>>>>  window.setTimeout(function() { x.a(); }, 10);
>>> You don’t say (I suppose creating a superfluous function object is
>>> justified by not resolving those pesky identifiers first :^)
>> The Function instance is not superfluous.  If you do not use the function
>> expression here, then only the reference to `x.a' will be called, which
>> means that `x.a' will be called as a method of the object that `window'
>> refers to, or if you will, the global object.  As a result, `this' in
>> `x.a' would not refer to the same object as `x', but to the other object.
> 
> That’s why I provided that example. I don’t know what makes you think
> that you have to explain that (or what the ‘module pattern’ is) to me.

Your example does not make any sense.  Why call a method of a user-defined 
object as a method of the window/global object?


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

calling function within (function() {...})(); Andrew Poulos <ap_prog@hotmail.com> - 2011-11-04 23:18 +1100
  Re: calling function within (function() {...})(); Gregor Kofler <usenet@gregorkofler.com> - 2011-11-04 14:06 +0100
    Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-04 14:13 +0100
      Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-04 15:49 +0100
        Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-04 16:35 +0100
          Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-04 20:44 +0100
            Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-04 21:16 +0100
              Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-04 21:24 +0100
                Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-04 21:46 +0100
                Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-04 23:29 +0100
        Re: calling function within (function() {...})(); Scott Sauyet <scott.sauyet@gmail.com> - 2011-11-04 10:29 -0700
          Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-09 15:17 +0100
            Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-09 20:13 +0100
              Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-11 23:26 +0100
                Re: calling function within (function() {...})(); Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2011-11-11 23:31 +0100
                Re: calling function within (function() {...})(); Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-12 00:38 +0100

csiph-web