Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-25 Thread Tobias Oberstein
I have collected the Deferreds from Nevow MochiKit Closure jQuery (and Twisted) here https://github.com/oberstet/jdeferred/tree/master/others for convenient comparison. I'd be interested in baking a JS Deferred which - replicates the Twisted Deferred in semantics and syntax (API) as closely

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-25 Thread Allen Short
On Thu, Aug 25, 2011 at 4:29 AM, Tobias Oberstein tobias.oberst...@tavendo.de wrote: I know this is kinda OT for this list, but it could serve Twisted indirectly: by propagating it's mature, sane Deferred concept/terminology instead of half-baked, flawned others. In some ways the popular

[Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Tobias Oberstein
I follow Glyphs advice and only keep the lambda version with standard Twisted Deferred. However, I've got a (I believe) more serious design problem. The RPC stuff works in Twisted, but also from JavaScript. So I have 2 audiences (Twisted and JS developers). On JS, I use the Deferreds that

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Allen Short
No, this is something jQuery and CommonJS got wrong; callbacks don't chain in their implementation. Firing a jQuery promise invokes each callback in order with the same argument. Firing a Deferred in Twisted invokes the first callback then passes its return value as the arg to the next callback,

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Tobias Oberstein
Ok. This is most unpleasant. In particular since my options then are: 1) write my own, sane (Twisted like, which I think is the sane way) JS deferred, not use jQuery/CommonJS (which everyone else does) 2) open the door for users running into issues when they do both Twisted JS/jQuery and don't

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Jasper St. Pierre
As far as I know, Dojo's Deferreds are a direct port of Twisted's. On Wed, Aug 24, 2011 at 7:30 PM, Tobias Oberstein tobias.oberst...@tavendo.de wrote: Found something: it seems in jQuery 1.6 they have introduced something which corresponds more closely to Twisted Deferreds callback/errback

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Allen Short
My understanding (partially aided by this post: http://www.sitepen.com/blog/2010/05/03/robust-promises-with-dojo-deferred-1-5/) is that Dojo provides both twisted-style addCallback and CommonJS-style then methods. ___ Twisted-Python mailing list

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Richard Wall
On 25 August 2011 00:30, Tobias Oberstein tobias.oberst...@tavendo.de wrote: snip I am still wondering why they called the other stuff then() when it's not then, but also() and pipe() is the real then ;) I agree. I had the same frustration a few months ago and various Twisted people pointed

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread Tobias Oberstein
Jasper, Allen, Richard, thanks all for the pointers. I am confused now;) No, seriously, I need to _test_ those libs, to see what they actually do. I.e. I suspect the new Dojo Deferreds with then return something different than the broken then in jQuery 1.5. This is all messy, personally, I

Re: [Twisted-Python] Twisted vs jQuery Deferreds (was Re: RPC design questions)

2011-08-24 Thread L. Daniel Burr
Hi Jasper, On Wed, 24 Aug 2011 19:48:14 -0500, Jasper St. Pierre jstpie...@mecheye.net wrote: Note that as far as I know, MochiKit isn't actively developed anymore. Google's Closure has a fork of MochiKit's Deferred's, which seems to incorporate some of Dojo's code as well.