"Asynchronous" has a good (Greek) meaning but it is overused and abused. JS setTimeout is in fact not truly "without time" but more nearly "synchronous" to some resolution lower bound (4ms in the new HTML5 world), or "isochronous" in some virtual timeline.

With setTimeout and setInterval and nothing else (in particular, no XHR), there is no racy multi-threaded concurrency that can truly race when mapped onto parallel hardware. There is no indefinite-future tense asynchrony based on communicating networked or even machine-local peers.

So again, IMHO setTimeout etc. is not in the core language mainly due to an artificial division of labor between "the core language" and "the DOM level 0".

Add to that the fact that Netscape and Microsoft failed, or chose not to, standardize the DOM level 0, and we have the current split where setTimeout is in HTML5 but the core language is embedded with increasing success in non-browser, no-DOM host environments *that want setTimeout*.

I'm open to Ecma TC39 absorbing setTimeout and the minimum machinery it entrains. We should ping Hixie.

/be

On Mar 18, 2011, at 9:41 AM, liorean wrote:

On 18 March 2011 17:25, Wes Garland <[email protected]> wrote:
Right: the barrier to setTimeout functionality is that ECMAscript does not
define a concurrency model.

If we can define a concurrency model, then we can build setTimeout.

Two things off the top of my head to consider:
- timer granularity
- forbidding eval-like syntax

OTOH, if we have an event-loop system with conditionals, we might not need
setTimeout because it would be trivial to build from primitives. But it
might be a handy interface if ES starts to go toward the "batteries
included" model.


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.

--
David "liorean" Andersson
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to