After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 443525 - default implementation of interface methods
default implementation of interface methods
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
0.1.x
Other All
: Normal enhancement
: ---
Assigned To: Jürg Billeter
Vala maintainers
: 546305 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-06-03 11:57 UTC by Michael Lawrence
Modified: 2010-10-14 08:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Lawrence 2007-06-03 11:57:17 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.
Comment 1 Jürg Billeter 2007-06-04 10:03:42 UTC
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.
Comment 2 Jürg Billeter 2007-12-16 16:49:26 UTC
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
Comment 3 Jürg Billeter 2008-04-19 21:18:17 UTC
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.
Comment 4 Jürg Billeter 2010-10-14 08:33:50 UTC
*** Bug 546305 has been marked as a duplicate of this bug. ***