Promise-returning delay function

Brendan Eich brendan at mozilla.org
Sun Oct 26 21:41:40 PDT 2014


Domenic Denicola wrote:
> BTW I definitely agree that promise-returning `delay(ms)` as a better `setTimeout` should be part of the standard library.

See https://twitter.com/garybernhardt/status/526435690524196864 where 
I'm subtweeted but with some justice. setTimeout began life taking only 
a program to eval, and given the general implicit-conversion mania 
afflicting me and others at Netscape, it converts its first argument to 
string source for that program. Only in Netscape 3 did the funarg-first 
form come in.

Sorry about that, and you're right -- at some promise-allocation and 
cognitive load costs, a new API could win. Another option is to have a 
new functional API, but I bet it won't be easy to name well or get approved.

/be




More information about the es-discuss mailing list