Re: XPIDL & Promises

2013-07-31 Thread Paolo Amadini
On 30/07/2013 16.20, janjongb...@gmail.com wrote: > From code I can use Cu.import("resource://gre/modules/Promise.jsm"); to use > promises. But is it possible to have a promise as a return type in my .idl > file (b2g)? For the record, if you want to pass a "Promise.jsm" promise through an XPCOM

Re: XPIDL & Promises

2013-07-31 Thread Paolo Amadini
On 30/07/2013 22.40, Andreas Gal wrote: > Whats the main pain point? Whether promises are resolved immediately or > from a future event loop iteration? That. The migration from "core/promise.js" to "Promise.jsm" should address consumers expecting callbacks to be called immediately. "Promises.jsm"

Re: XPIDL & Promises

2013-07-30 Thread Joshua Cranmer 🐧
On 7/30/2013 1:17 PM, Boris Zbarsky wrote: On 7/30/13 11:13 AM, Dave Townsend wrote: The JS promise implementation came out of a desire to use promises in add-ons and devtools amongst others. I believe the C++ implementation came out of the DOM spec. I'm not sure why we need both. OK. Given

Re: XPIDL & Promises

2013-07-30 Thread Brandon Benvie
On 7/30/2013 1:41 PM, Boris Zbarsky wrote: On 7/30/13 1:37 PM, Gavin Sharp wrote: We'll need to investigate whether the implementations are compatible, though That's fair. DOM Promises are definitely modeled after Promises/A+, but the APIs might not quite match up. :( They don't. With DOM

Re: XPIDL & Promises

2013-07-30 Thread Boris Zbarsky
On 7/30/13 1:37 PM, Gavin Sharp wrote: We'll need to investigate whether the implementations are compatible, though That's fair. DOM Promises are definitely modeled after Promises/A+, but the APIs might not quite match up. :( -Boris ___ dev-platf

Re: XPIDL & Promises

2013-07-30 Thread Andreas Gal
Whats the main pain point? Whether promises are resolved immediately or from a future event loop iteration? Andreas Gavin Sharp wrote: On Tue, Jul 30, 2013 at 11:17 AM, Boris Zbarsky wrote: On 7/30/13 11:13 AM, Dave Townsend wrote: The JS promise implementation came out of a desire to use

Re: XPIDL & Promises

2013-07-30 Thread Gavin Sharp
On Tue, Jul 30, 2013 at 11:17 AM, Boris Zbarsky wrote: > On 7/30/13 11:13 AM, Dave Townsend wrote: >> >> The JS promise implementation came out of a desire to use promises in >> add-ons and devtools amongst others. I believe the C++ implementation came >> out of the DOM spec. I'm not sure why we n

Re: XPIDL & Promises

2013-07-30 Thread Johnny Stenback
Maybe, but also, generally speaking we shouldn't be using .idl files for b2g any more, at least not writing new ones. We should be implementing things with WebIDL. What's the case where we need/want this here? On 7/30/2013 7:51 AM, Andreas Gal wrote: > > Yeah, I just saw that grepping through the

Re: XPIDL & Promises

2013-07-30 Thread Boris Zbarsky
On 7/30/13 11:13 AM, Dave Townsend wrote: The JS promise implementation came out of a desire to use promises in add-ons and devtools amongst others. I believe the C++ implementation came out of the DOM spec. I'm not sure why we need both. OK. Given that there is also a desire to be able to use

Re: XPIDL & Promises

2013-07-30 Thread Dave Townsend
The JS promise implementation came out of a desire to use promises in add-ons and devtools amongst others. I believe the C++ implementation came out of the DOM spec. I'm not sure why we need both. On Tue, Jul 30, 2013 at 7:51 AM, Andreas Gal wrote: > > Yeah, I just saw that grepping through the

Re: XPIDL & Promises

2013-07-30 Thread Andreas Gal
Yeah, I just saw that grepping through the tree. Both completely independent, too. On the upside, this might solve Jan's problem. Andreas Boris Zbarsky wrote: On 7/30/13 7:36 AM, Andreas Gal wrote: For that we would have to implement Promise via IDL. Definitely possible. All you need is a b

Re: XPIDL & Promises

2013-07-30 Thread Boris Zbarsky
On 7/30/13 7:43 AM, Boris Zbarsky wrote: On 7/30/13 7:20 AM, janjongb...@gmail.com wrote: But is it possible to have a promise as a return type in my .idl file (b2g)? Just list it as nsISupports in the .idl. XPConnect will do the right thing. Ignore the above; I thought you were talking abo

Re: XPIDL & Promises

2013-07-30 Thread Boris Zbarsky
On 7/30/13 7:20 AM, janjongb...@gmail.com wrote: But is it possible to have a promise as a return type in my .idl file (b2g)? Just list it as nsISupports in the .idl. XPConnect will do the right thing. -Boris ___ dev-platform mailing list dev-platfo

Re: XPIDL & Promises

2013-07-30 Thread Boris Zbarsky
On 7/30/13 7:36 AM, Andreas Gal wrote: For that we would have to implement Promise via IDL. Definitely possible. All you need is a bit IDL and some JS that implements it. It would be a lot slower than the jsm since it wraps into C++ objects that call into JS, but in most cases that doesn't really

Re: XPIDL & Promises

2013-07-30 Thread Andreas Gal
For that we would have to implement Promise via IDL. Definitely possible. All you need is a bit IDL and some JS that implements it. It would be a lot slower than the jsm since it wraps into C++ objects that call into JS, but in most cases that doesn't really matter. Andreas janjongb...@gmai