Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7363
| Message-ID | <1642787.IUjFaCZJrE@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2011-10-13 21:36 +0200 |
| Subject | Re: closure bindings |
| Newsgroups | comp.lang.javascript |
| References | (4 earlier) <2994749.SPkdTlGXAF@PointedEars.de> <1d5abff7-3bdd-4046-8c57-0d398f76049e@l11g2000prh.googlegroups.com> <8914731.SEqChMirdb@PointedEars.de> <09dd3324-8ad3-4af6-99f7-128c29c66711@j19g2000vbn.googlegroups.com> <1582342.FiOE1xPOLP@PointedEars.de> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
Thomas 'PointedEars' Lahn wrote:
> Michael Haufe (TNO) wrote:
>> Thomas 'PointedEars' Lahn wrote:
>>> Michael Haufe (TNO) wrote:
>>> > Thomas 'PointedEars' Lahn wrote:
>>> >> BTW, how do you pass a *scope* to a method?
>>> > - pass "this" from the global scope to get a reference to it
>>>
>>> `this' has nothing to do with scope.
>>
>> PowerShell has scope as an object to manipulate:
>> $global:foo = "bar";
>> $local:foo="bar";
>> $7:foo="bar";
>>
>> […]
>> So for the above, the emulated effect can be seen for this specific
>> case:
>>
>> var foo = "bar"
>>
>> function test(s){
>> WScript.Echo(s.foo)
>> }
>>
>> test(this) //bar
>>
>> function change(s){
>> s.foo = "quux"
>> }
>>
>> change(this)
>>
>> test(this) //quux
>
> And AISB, and we discussed at length before, `this' has nothing to do with
> scope. You can see that confirmed, not refuted, here. It is only that
> the ECMAScript Global Object serves as the Variable Object for the global
> execution context (to avoid the even more complicated ES5 terminology)
> that it *appears* *as* if* the opposite was the case.
>
> Wrap this in `(function() { … })()' and it will cease working (if it
> worked before), i. e. both test() calls will show `undefined', and in
> change() the global object will be added a `foo' property, if that.
Err, the first test() call will show `undefined' (unless the global object
already had a property of that name and a value different from `undefined'),
the second one will show `quux' if creation or modification of the property
of the global object was successful.
PointedEars
--
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 <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar
Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 10:44 -0700
Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-10 14:24 -0700
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-10 22:36 -0700
Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 23:41 -0700
Re: Google Dart Released Today "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-11 05:33 -0700
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 14:06 -0700
Re: Google Dart Released Today Swifty <steve.j.swift@gmail.com> - 2011-10-12 07:13 +0100
closure bindings (was: Google Dart Released Today) Andreas Bergmaier <andber93@web.de> - 2011-10-11 23:56 +0200
Re: closure bindings (was: Google Dart Released Today) David Mark <dmark.cinsoft@gmail.com> - 2011-10-11 16:20 -0700
Re: closure bindings Bwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid> - 2011-10-12 15:02 +0530
Re: closure bindings Antony Scriven <adscriven@gmail.com> - 2011-10-12 05:12 -0700
Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:27 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 13:24 +0200
Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 08:56 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-12 21:15 +0200
Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-12 15:21 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 20:56 +0200
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-13 21:36 +0200
Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-13 16:41 -0700
Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-13 22:39 -0700
Re: closure bindings "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-14 09:03 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 20:05 +0200
Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:38 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-14 23:34 +0200
Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 16:56 -0700
Re: closure bindings Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-15 02:44 +0200
Re: closure bindings dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 21:18 -0700
Re: closure bindings David Mark <dmark.cinsoft@gmail.com> - 2011-10-12 18:28 -0700
Re: Google Dart Released Today Antony Scriven <adscriven@gmail.com> - 2011-10-11 15:13 -0700
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-11 22:33 -0700
Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-12 07:27 -0700
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 18:29 -0700
Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 08:21 +0000
Re: Google Dart Released Today Scott Sauyet <scott.sauyet@gmail.com> - 2011-10-13 04:46 -0700
Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 14:03 +0200
Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 12:40 +0000
Re: Google Dart Released Today unbewusst.sein@fai.invalid (Une Bévue) - 2011-10-13 17:51 +0200
Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 13:31 +0000
Re: Google Dart Released Today Duncan Booth <duncan.booth@invalid.invalid> - 2011-10-13 15:17 +0000
Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-14 13:02 +0200
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-14 12:36 -0700
Re: Google Dart Released Today Karl Tikjøb Krukow <karl.krukow@gmail.com> - 2011-10-15 19:30 +0200
Re: Google Dart Released Today David Mark <dmark.cinsoft@gmail.com> - 2011-10-10 22:23 -0700
Re: Google Dart Released Today Matt McDonald <matt@fortybelow.ca> - 2011-10-12 19:48 -0600
Re: Google Dart Released Today dhtml <dhtmlkitchen@gmail.com> - 2011-10-12 21:04 -0700
csiph-web