GNOME Bugzilla – Bug 443525
default implementation of interface methods
Last modified: 2010-10-14 08:33:50 UTC
In GObject, it is possible to provide "default implementations" of methods in interfaces by placing code in the public wrapper function. Could this be supported in Vala? It's already possible to have non-virtual methods on interfaces, so this feature would be consistent with that.
We're currently not planning to support such "default implementations" as this would result in different results when using the wrapper and not using the wrapper and I don't think that we should encourage this behavior. It might also lead to more multiple inheritance related problems, which is something the interface approach tries to solve. I may change my opinion if gobject design experts state that the "default implementation" possibility has been added intentionally. Reopen if that's the case. You might want to consider using an abstract class instead of an interface if possible.
It seems[1] that we need to support optional interface methods for GObject interfaces to cope with enhancements to existing interfaces. Optional interface methods require support for default implementations, so we have to add this to Vala. [1] http://mail.gnome.org/archives/gtk-devel-list/2007-November/msg00048.html
2008-04-19 Jürg Billeter <j@bitron.ch> * vala/valasemanticanalyzer.vala, gobject/valaccodeinterfacebinding.vala: support virtual methods in interfaces, fixes bug 443525 Fixed in r1275.
*** Bug 546305 has been marked as a duplicate of this bug. ***