[Kde-bindings] Implementing Ruby DCOP

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Sep 26 06:57:11 UTC 2003


On Friday 26 September 2003 06:31, Alexander Kellett wrote:
> On Thu, Sep 25, 2003 at 07:02:25PM -0700, Ashley Winters wrote:
> > If I were writing it for Perl, I would likely hijack dcopClient() (or
> > the object it's returning) to return an object which would accept
> > methods through AUTOLOAD. I'd try to make it work like:
> >
> > $kapp->dcopClient->clientDied($pid)
> >
> > I suspect something similar is possible in Ruby, if so inclined?
>
> yeah. and with a sane syntax :)
>
> i'd suggest $kapp->dcopClient->signals->clientDied($pid)
> personally to keep method name collisions down.

I like this one best at the moment:
 $kapp.dcopClient().emit clientDied(pid) 

emit() is the same 'do nothing' emit we already have.

With a declaration:
k_dcop_signals 'clientDied(pid_t)'

Then a clientDied() method would be dynamically added to the ruby dcopClient() 
instance, similar to how methods are added dynamically at the moment for 
ordinary signals.

I've decided the code for invoking a DCOP slot should look much like the 
existing InvokeSlot class with a method copyArguments(). Instead of copying 
the args from the QUObject's, it would copy them from the QDataStream onto 
the Smoke::Stack, via the '>>' methods called from the Smoke runtime. After 
that they would be much the same I think, apart from another class 
DCOPReturnValue for taking the return value on the stack and converting to 
the return value data stream.

-- Richard


More information about the Kde-bindings mailing list