[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KTextEditor enhancement
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2001-10-08 10:08:00
[Download RAW message or body]

On Mon, Oct 08, 2001 at 11:49:58AM +0200, Bernd Gehrmann wrote:
> On Mon, 8 Oct 2001, Simon Hausmann wrote:
> > UndoInterface *undo = dynamic_cast<UndoInterface *>( document );
> > if ( !undo )
> >     return; // ...
> > 
> > fooBar( undo->isRedoAvailable() );
> > 
> > connect( document, SIGNAL( undoStatusChanged( bool ) ),
> >          bleh, SLOT( bar() ) );
> 
> But for this you have to declare the signal in the implementation
> class, not in the interface? I mean, this works, because of the
> dynamical nature of signal/slot connections, but the interface
> is then not self-documenting anymore.

Yes, correct. It requires the developer designing the interface to
document (as comment in the interface or maybe using a dummy macro)
the signals he would like to see. True, it's no real contract
anymore, with the effect of a uncritical runtime warning, in case
of failure. Yes, it's not perfect, but is that that bad on the other 
hand? (comparing this disadvantage with the advantages :-)


Simon

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic