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


Groups > comp.lang.javascript > #32283

Re: [Firefox]"print"

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: [Firefox]"print"
Date 2017-01-24 01:52 +0100
Organization PointedEars Software (PES)
Message-ID <42447262.MN2xkq1pzW@PointedEars.de> (permalink)
References <8b2dc802-a0d2-4ae0-ba75-98ecf5989e64@googlegroups.com> <87bmv2erpx.fsf@bsb.me.uk> <const-20170119213913@ram.dialup.fu-berlin.de> <print-20170120103915@ram.dialup.fu-berlin.de> <Object.getOwnPropertyDescriptor-20170123205042@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram kept talking to himself:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> Let's look at the property:
>> Object.getOwnPropertyDescriptor( this, print )
>> undefined
> 
>   Ok, I should have written:
> 
> Object.getOwnPropertyDescriptor( this, "print" )

“print” in Mozilla JavaScript is still something else than
“this.print” (in global browser context equivalent to “window.print”):

| $ dpkg -l libmozjs-24-bin | grep ^.i
| ii  libmozjs-24-bin 24.2.0-2     amd64       Spidermonkey JavaScript shell
| 
| $ dpkg -L libmozjs-24-bin 
| /.
| /usr
| /usr/bin
| /usr/bin/js24
| /usr/share
| /usr/share/doc
| /usr/share/doc/libmozjs-24-bin
| /usr/share/doc/libmozjs-24-bin/changelog.Debian.gz
| /usr/share/doc/libmozjs-24-bin/copyright 
| 
| $ js24
| js> help(print);
| JavaScript-C24.2.0
| print([exp ...])
|   Evaluate and print expressions to stdout.
| js> 

By contrast,

| $ js --help | head -n 1
| Usage: node [options] [ -e script | script.js ] [arguments] 
| 
| $ js -v
| v0.10.38

Node.js 0.10.38, …

| $ js -e 'console.log(process.versions.v8);'
| 3.14.5.8

based on Google V8 JavaScript 3.14.5.8):

| $ js -e 'print(42);'
| 
| [eval]:1
| print(42);
| ^
| ReferenceError: print is not defined
|     at [eval]:1:1
|     at Object.<anonymous> ([eval]-wrapper:6:22)
|     at Module._compile (module.js:456:26)
|     at evalScript (node.js:536:25)
|     at startup (node.js:80:7)
|     at node.js:906:3

So this has nothing to do with Firefox and its Web Console, everything with 
the ECMAScript implementation (provided by the Gecko layout engine) that is 
used by it.

It is most obvious in the result of what you have *not* tried so far:

,-[Iceweasel 38.1.0 Web Console]
| 
| 01:28:04.562 > print();
| 01:28:04.569 < "undefined"
| 01:28:09.221 > print
| 01:28:09.230 < function JSTH_print()
| 01:28:16.522 > this.print
| 01:28:16.538 < function print()
| 01:31:00.768 > window.print
| 01:31:00.775 < function print()
| 01:31:13.967 > this.print === window.print
| 01:31:13.974 < true
| 01:31:49.429 > print(42);
| 01:31:49.436 < "42"

(Exercise: Try the same in Chromium or Chrome.)

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | 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

Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-18 20:09 -0800
  Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 20:10 +0000
    Re: Functional Programming needs some real world use cases Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-19 21:16 +0100
      Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:24 +0000
    Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 12:34 -0800
      Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 12:41 -0800
        Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 13:01 -0800
          Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 17:26 -0800
    Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:23 +0000
      Re: Functional Programming needs some real world use cases Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-19 21:50 +0000
    Re: [Firefox]"print" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 01:52 +0100
      Re: [Firefox]"print" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-24 05:45 +0100
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 04:28 +0000
    Re: Functional Programming needs some real world use cases justaguy <lichunshen84@gmail.com> - 2017-01-19 21:18 -0800
    Re: Functional Programming needs some real world use cases John Harris <niam@jghnorth.org.uk.invalid> - 2017-01-20 10:22 +0000
      Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-21 01:29 +0000
    Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-21 01:15 +0000
    Re: Functional Programming needs some real world use cases "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-21 15:00 -0800
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 05:00 +0000
  Re: Functional Programming needs some real world use cases Scott Sauyet <scott@sauyet.com> - 2017-01-20 05:02 +0000

csiph-web