Bringing setTimeout to ECMAScript

David Bruant david.bruant at
Sun Mar 20 10:34:13 PDT 2011

Le 20/03/2011 18:23, Boris Zbarsky a écrit :
> On 3/20/11 1:19 PM, David Bruant wrote:
>> I agree that some properties of a scheduling policy can be tested (like
>> you can test that times moves forward with two sequential calls to
>> or testing statistical properties of Math.rand()) but there
>> is something in the time that code uses to execute that is inherently
>> non-determinist (the dead code elimination optimization is actually an
>> excellent proof of this). This cannot be avoided in my opinion, making
>> scheduling policy non-testable, not verifyable and hence non-relyable.
> It should be possible to statistically verify (which is the only way
> you can verify anything via a test suite, by the way) the following
> assertion:  "Given two calls |setTimeout(f, n)| and |setTimeout(g, n)|
> using the same value of |n|, if the |setTimeout(f, n)| happens before
> the |setTimeout(g, n)| then f will be called before g."
That's what I understand Kyle was testing too (the loop wasn't
necessary) and I agree (as I said). Testing some properties and
expecting some properties to be respected sound like a good idea.

> Last I checked, the web depends on that behavior to some extent.
> Implementing it is not particularly burdensome.
> -Boris

More information about the es-discuss mailing list