Re: Standardizing console APIs: Where?

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