Why is AbstractFunctionDeclaration not a Declaration? Why is ClassFunctionDeclaration not a FunctionDeclaration?

Milian Wolff mail at milianw.de
Mon Mar 1 15:22:49 UTC 2010

David Nolden, 01.03.2010:
> Am Montag 01 März 2010 16:01:56 schrieb Milian Wolff:
> > Hey all, esp. David!
> > 
> > Is there any reason why an AbstractFunctionDeclaration does not inherit
> > 
> >  from Declaration? And why is a ClassFunctionDeclaration only an
> > 
> > AbstractFunctionDeclaration, but not a normal FunctionDeclaration?
> > 
> > I find that rather unintuitive and makes my code harder since I cannot
> > use simple polymorphie to handle methods and functions (in my case no
> > 
> >  difference) in one go...
> > 
> > Anything against me changing that?
> This cannot be changed, due to multiple inheritance.
> A ClassFunctionDeclaration inherits ClassMemberDeclaration as well as
> AbstractFunctionDeclaration, and a FunctionDeclaration inherits Declaration
> and AbstractFunctionDeclaration.
> "Declaration" must be only once in the whole inheritance chain, and for
> that reason AbstractFunctionDeclaration is a pure abstract class that is
> just "added" to FunctionDeclaration and ClassFunctionDeclaration. The only
> other option would be making ClassMemberDeclaration such an abstract
> class, but that would be a rather useless change.

So there is no useful connection whatsoever between a FunctionDeclaration and 
ClassFunctionDeclaration - except for AbstractFunctionDeclaration (typesafe 
but useless data) or Declaration (not typesafe yet the info I need).

Or should I only pass pointers to AbstractFunctionDeclarations around and cast 
them to... well what - Declarations?

This is rather ugly to work with I must say. Of course I see the problem, yet 
I do hope that there is some way to make it work nicer!
Milian Wolff
mail at milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100301/2f1e483c/attachment.sig>

More information about the KDevelop-devel mailing list