Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.straub-nv.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1521061.40VBb9nUPl@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Fri, 04 Nov 2011 21:46:32 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit Subject: Re: calling function within (function() {...})(); Newsgroups: comp.lang.javascript References: <8928443.SEqChMirdb@PointedEars.de> <2999240.SPkdTlGXAF@PointedEars.de> <1932703.nKmheAe9J7@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 30 NNTP-Posting-Date: 04 Nov 2011 21:46:32 CET NNTP-Posting-Host: 5556eb3c.newsspool4.arcor-online.net X-Trace: DXC=ogB9VbT:6jKFV6LP@XgM> X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:8011 Thomas 'PointedEars' Lahn wrote: > Eric Bednarz wrote: >> Thomas 'PointedEars' Lahn 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? For that matter, why call it asynchronously on top of that? -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from (404-comp.)