[Kde-bindings] Implementing Ruby DCOP

Alexander Kellett lypanov at kde.org
Fri Sep 26 08:06:32 UTC 2003


On Fri, Sep 26, 2003 at 08:43:19AM +0100, Richard Dale wrote:
> On Friday 26 September 2003 08:23, Richard Dale wrote:
> > On Friday 26 September 2003 07:57, Richard Dale wrote:
> > > I like this one best at the moment:
> > >  $kapp.dcopClient().emit clientDied(pid)
> >
> > Oops, I don't think that will work. It should be:
> >
> > $kapp.dcopClient().emit.clientDied(pid)
> >
> > All this emit does is take zero args and return self.

this is admittedly more like the c++ version,
and is very easy to implement using method_missing.

but really i'd suggest that whatever is chosen is
natural to ruby, easy to convert from the equivalent 
c++, and applicable to both dcop and non dcop signals. 

> Here's another couple, emitting a block is more ruby-like perhaps?
> 
>    $kapp.dcopClient().emitDCOPSignal { clientDied(pid_t) }
>    
>    $kapp.dcopClient().emit { clientDied(pid_t) }
> 
> 'emitDCOPSignal' name seems to long and noisy to me - I can't see what else a 
> dcopClient would be emitting other than a dcop signal.

not really sure i like this syntax, and its pretty
difficult to implement :) - you need to do a temporary
override on the blocks method_missing. which is
probably possibly knowing ruby, but i've not idea
how to do so :)

mvg,
Alex


More information about the Kde-bindings mailing list