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


Groups > comp.lang.javascript > #27927

Re: Expression for the global object

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Expression for the global object
Date 2015-05-30 15:20 +0200
Organization PointedEars Software (PES)
Message-ID <1568146.gjZlAL6gd7@PointedEars.de> (permalink)
References (1 earlier) <645d86ba-2299-4371-bb64-90dae6df316a@googlegroups.com> <1442639.SsZ0RATE5U@PointedEars.de> <79b520ed-6efe-4064-a9cf-ea66c60f00df@googlegroups.com> <12824458.XGgQv3ng7H@PointedEars.de> <36af7f41-d441-48a2-81a1-28e16e063e54@googlegroups.com>

Show all headers | View raw


Michael Haufe (TNO) wrote:

> […] Thomas 'PointedEars' Lahn wrote:
>> | [[Scope]]
> 
> [...]
> 
>>[...] This scope is obviously "without "use strict"".  [...]
> 
> We need to be clear and consistent in terminology then. "scope" vs
> "[[Scope]]"

I fail to see a difference.

> I am using "scope" as it is commonly used: "the textual region of a
> program in which a binding is active".

So do I.  However, it is prudent to use a definition from the ECMAScript 
Language Specification when discussing implementations of ECMAScript.

> Thus, if I had the following:
> 
> var x = "foo";
> 
> (function(){
>     var y = "bar"
> })();
> 
> 'x' is still "in scope" inside the body of the function.

Yes.

> Following the same vein regarding "use strict";

"in scope" is a necessary, but not a sufficient criterion.

You can never be sure that your code is only executed in the global context, 
and the global context always can enforce strict mode.  In fact, it is 
reasonable to assume that it is not, because of the side effects and of the 
prevalence of the module pattern.

It is not logical to use approaches that make code less compatible than it 
needs to be.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


Thread

Re: Expression for the global object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-05-28 13:49 -0700
  Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-28 22:59 +0200
    Re: Expression for the global object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-05-29 07:24 -0700
      Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-29 17:24 +0200
        Re: Expression for the global object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-05-30 06:07 -0700
          Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-30 15:20 +0200
            Re: Expression for the global object Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-05-30 11:23 -0300
              Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-30 19:05 +0200
  Re: Expression for the global object Steven D'Aprano <steve@pearwood.info> - 2015-05-29 15:30 +1000
    Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-29 12:25 +0100
      Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-29 13:33 +0200
        Re: Expression for the global object Steven D'Aprano <steve@pearwood.info> - 2015-05-29 21:50 +1000
          Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-29 14:57 +0100
            Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-31 16:18 +0200
  Re: Expression for the global object "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-05-29 07:31 -0700
    Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-30 15:25 +0200
  Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-30 18:56 +0200

csiph-web