Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29072
| From | Teemu Likonen <tlikonen@iki.fi> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Scope of "this" variable |
| Date | 2015-12-30 10:57 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <8737ukgvpr.fsf@mithlond.arda> (permalink) |
| References | <87ziwtqc9t.fsf@mithlond.arda> <87k2nx7zjg.fsf@bsb.me.uk> |
[Multipart message — attachments visible in raw view] - view raw
Ben Bacarisse [2015-12-29 20:47:15Z] wrote: > ["this"] is a keyword and not the name of a variable and does not have > scope. But the object to which the keywords refers does changes as > execution contexts are created, entered and exited. As such it feels a > bit like something with scope, but trying to fit it into the model of > a scoped name will just cause confusion. > When you call a method like item1.foo.fn2, part of the process > establishes a value for 'this'. Calling x.f(...) executes f in a > context in which this refers to x. Here, 'this' will refer to > item1.foo. I think you'll agree that you want that behaviour more often > than not. Thank you, and everybody. Many good details were given. I come mostly From Common Lisp (I'm still "there") and even the semantics of this dot.notation.thing is quite new to me, even though its very common. But I got a fair step forward with this discussion and by reading the standard. Thanks. -- /// Teemu Likonen - .-.. <https://github.com/tlikonen> // // PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 ///
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Scope of "this" variable Teemu Likonen <tlikonen@iki.fi> - 2015-12-29 21:34 +0200
Re: Scope of "this" variable Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-12-29 20:47 +0000
Re: Scope of "this" variable Teemu Likonen <tlikonen@iki.fi> - 2015-12-30 10:57 +0200
Re: Scope of "this" variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-29 22:09 +0100
Re: Scope of "this" variable Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-29 19:38 -0200
Re: Scope of "this" variable Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-29 19:46 -0200
Re: Scope of "this" variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-30 00:42 +0100
Re: Scope of "this" variable Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-30 00:35 +0100
Re: Scope of "this" variable Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-30 02:18 -0200
csiph-web