W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2013

Re: Standardizing console APIs: Where?

From: Jorge Chamorro <jorge@jorgechamorro.com>
Date: Tue, 26 Feb 2013 10:47:14 +0100
Cc: Marcos Caceres <w3c@marcosc.com>, Brian Kardell <bkardell@gmail.com>, "Hill, Clint" <Clint.Hill@goaaa.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-Id: <D79B0617-39F9-4E3A-B455-38339F69F46B@jorgechamorro.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
El 26/02/2013, a las 07:28, Domenic Denicola escribió:

> On Monday, February 25, 2013 at 09:54, Marcos Caceres wrote:
> 
>> _However_, if evidence of interoperability issues can be presented, and those are causing developer pain, then that makes for a stronger case for standardisation.
> 
> One case of pain I've seen is that in some browsers, `console.log` is bound to `console` (Firefox and Node.js, that I know of). Whereas in others, it is not (Chrome, that I know of).
> 
> The former behavior is much more convenient, and allows writing code like `array.forEach(console.log)`. However, such code is not portable across runtimes, as in the ones without a bound `console.log`, it fails with some cryptic error message.
> 
> Standardizing on bound versions of the functions would be nice!

Yes, there's lots of glitches, here's another one:

Safari, firefox, chrome:

(a=[], function() { for (var i=0 ; i<10 ; i++) { a[0]=i; console.log(a); } })()
[9]
[9]
[9]
[9]
[9]
[9]
[9]
[9]
[9]
[9]

node, opera dragonfly:
> (a=[], function() { for (var i=0 ; i<10 ; i++) { a[0]=i; console.log(a); } })()
[ 0 ]
[ 1 ]
[ 2 ]
[ 3 ]
[ 4 ]
[ 5 ]
[ 6 ]
[ 7 ]
[ 8 ]
[ 9 ]

-- 
Jorge.
Received on Tuesday, 26 February 2013 09:47:44 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:09 UTC