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


Groups > comp.lang.javascript > #27947

Re: Expression for the global object

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Expression for the global object
Date Sun, 31 May 2015 16:41:20 +0100
Organization A noiseless patient Spider
Lines 50
Message-ID <87lhg4hhzz.fsf@bsb.me.uk> (permalink)
References <JavaScript-20150528222318@ram.dialup.fu-berlin.de> <Function-20150531094321@ram.dialup.fu-berlin.de> <87twuthx5h.fsf@bsb.me.uk> <5452925.Zt9fTqAOub@PointedEars.de> <87382cj1f5.fsf@bsb.me.uk> <7546503.qSl4iIXIz1@PointedEars.de> <87wpzohk1k.fsf@bsb.me.uk> <1658801.5VaNTTmUhE@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
Injection-Info mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="30932"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++nii/HbKvrm6NboOHcgr+2wV+jDRO0Uc="
Cancel-Lock sha1:/qu1IVojgnpyyvmqiToD4uSWaFI= sha1:3plwyVd0IZZaDWinAjEYkfF7YNQ=
X-BSB-Auth 1.658dd5252d7d32522eed.20150531164120BST.87lhg4hhzz.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:27947

Show key headers only | View raw


Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> Ben Bacarisse wrote:
>
>> Given:
>> 
>>   'use strict';
>>   console.log((function () { return eval; })()("this") === global);
>>   console.log(eval("this") === global);
>>   console.log(this === global);
>> 
>> nodejs prints:
>> 
>>   NaN
>>   undefined
>>   undefined
>
> No, it does not.  Because Node.js’s V8 JavaScript is not so badly designed 
> that it would print “NaN” or “undefined” as the result of a “===”
> operation.

I edited the code to be more explicit[1] and obviously forgot to edit the
output.  It's

  true
  false
  false

>> […]
>>> <http://ecma-international.org/ecma-262/5.1/#sec-10.4.2>
>> 
>> Sure, but what does 15.1.2.1.1 (Direct Call to Eval) have to say about
>> it? You can interpret the words there much more readily than I can, and
>> it would seem that at least one implementation has decided that the
>> evaluation of the thunk above is not a "direct call to eval".
>
> We’ll see.

What do you mean by that?

[1] The original code showed access to, NaN, a property of the global
object:

  'use strict';
  console.log((function () { return eval; })()("this").NaN);
  console.log(eval("this").NaN);
  console.log(this.NaN);

-- 
Ben.

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


Thread

Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-31 11:14 +0100
  Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-31 15:08 +0200
    Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-31 14:56 +0100
      Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-31 16:12 +0200
        Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-31 15:57 +0100
          Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-31 17:33 +0200
            Re: Expression for the global object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-31 16:41 +0100
      Re: Expression for the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-31 16:21 +0200

csiph-web