- From: Ian Hickson <ian@hixie.ch>
- Date: Thu, 18 Jul 2013 00:39:26 +0000 (UTC)
- To: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
- Cc: Justin Novosad <junov@google.com>, WHAT Working Group <whatwg@whatwg.org>
On Thu, 18 Jul 2013, Silvia Pfeiffer wrote: > > We have the same issues with WebRTC, which already has a callback based > API, but there is a suggestion to replace/augment with a Promise based > API, so I just wanted to understand the motivation, potential > complications and implications. WebRTC's constructor is synchronous, no? There are callbacks, sure; there are callbacks all over the place in the Web platform. Promises themselves use callbacks. I don't understand the relevance to createImageBitmap(). > One issue is the change in API paradigm that we use. People have got > used to wrapping the callback API with a Promise style API when they > need it. Now they have to do both: wrap the browser API for a Promise > style API and wrap it for a callback style API. You don't have to wrap it for a callback style API. It _is_ a callback- style API. The only difference is the order of arguments. Instead of: foo(success, failure); ...you write: foo().then(success, failure); It's hardly cumbersome. > It may well be that Promises are the right way to go for > createImageBitmap(), but we are blazing a new trail here and need to be > careful about the implications. As far as I can tell, the only implications are that you can later use the Promise utility methods to combine things together, so you don't have to manage the callbacks yourself. This seems like a win. > For example, here is an interesting discussion thread with a statement > that node.js originally used Promises, but moved away from them for > several reasons, not least because they created a 20% performance > degradation with v8: > https://github.com/gladiusjs/gladius-core/issues/127#issuecomment-5212272 I think you're massively misreading that parenthetical. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 18 July 2013 00:39:50 UTC