I don't know about patching mochikit but it is possible to use a helper
function to solve this problem (if anyone is in immediate pain):

function athenahelper(func) {
        return function() {
                var args = [arguments[arguments.length > 0 ?
arguments.length-1 : 0]];
                for(var i=0;i<arguments.length-1;i++) {
                        args.push(arguments[i]);
                }
                func.apply(this,args);
        }
};

Function tester() {
        var dump = [];
        for(var i=0;i<arguments.length;i++) {
                dump.push(arguments[i]);
        }
        print(dump.join(','));
}


d = new Deferred();
d.addCallback(athenahelper(tester),'hi','hello);
d.callback('def');

'def','hi','hello'



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Bob Ippolito
Sent: Monday, December 12, 2005 4:12 PM
To: Dethe Elza
Cc: Tommi Virtanen; MochiKit
Subject: [mochikit] Re: Order of extra arguments when using
Deferred.addCallback()



On Dec 12, 2005, at 2:06 PM, Dethe Elza wrote:

>
> I don't use nevow, but the current API looks pretty natural to me,  
> putting the function, then (optionally) the arguments.  What is  
> wrong with that?

The difference is how the callback is called.  With Twisted, the  
result is always first; MochiKit, the result is always last.  I never  
liked Twisted's behavior, and the facilities to do Twisted style  
callbacks don't currently exist in MochiKit.

-bob



Reply via email to