- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Mon, 02 Sep 2013 23:30:38 -0400
- To: public-script-coord@w3.org
On 9/2/13 3:47 PM, David Bruant wrote: > It really isn't clear to me which is best. I wonder if type inference > magic can remove the async inside boilerplate in practice (if you can > prove that the context in which a built-in is called doesn't involve > promises, just provide the sync version directly). In theory, if you restrict it to actual DOM promises as opposed to thenables, you might be able to do something where you have a slow-path DOM function that does all the checks and stuff and a fast-path one that assumes your arguments are not Promises. Then the JIT might be able to emit a call to the fast-path one if it can prove that none of the arguments is a DOM promise. And if we spec the "check for promise" bits to happen before any argument coercions, of course. But it's not simple to do by any means, and would likely not work all that well in real life, outside microbenchmarks, I expect. > The cost (readability + runtime) of the outside boilerplate doesn't seem removable however. Yes, but only has to be paid by consumers who want the functionality! -Boris
Received on Tuesday, 3 September 2013 03:31:07 UTC