Bringing setTimeout to ECMAScript

Kyle Simpson getify at gmail.com
Fri Mar 18 09:51:06 PDT 2011


> As I understand it, this type of thing was kept out of the language
> proper intentionally, because of its strong dependency on host
> environment. Some host environments may require tight and overriding
> control of any event handling system, and exactly which types of
> events (such as timeouts) are suitable to an environment may vary. A
> server side host might not want to have to deal with asynchronous
> activity at all, for instance.

Speaking as someone who has written and currently maintains a *synchronous* 
server-side JavaScript environment (based on V8), I attest to the statement 
that I would *not* like it if V8 had `setTimeout()` (...etc) in it, because 
unless V8 were going to take care of that completely black-box for me, then 
I'd have to either disable such interfaces, or figure out some more 
complicated functionality in my environment to handle the "concurrency".

I prefer they stay out of the engine, unless the engine is going to 
completely take care of it. The most important part of the engine "taking 
care of it" would be blocking the end of the program to wait for any 
outstanding event loop "turns" that had not yet fired, etc. Seems like that 
could get really messy.

--Kyle

 



More information about the es-discuss mailing list