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 681097 - extension methods support
extension methods support
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-02 22:05 UTC by Marc-Andre Lureau
Modified: 2018-05-22 14:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add support for extension methods (8.14 KB, patch)
2014-03-29 17:21 UTC, Simon Werbeck
none Details | Review

Description Marc-Andre Lureau 2012-08-02 22:05:34 UTC
Talking with a Banshee developper last week, and I learned about the "Extension Methods", I was told it can be quite useful sometime. I find it nifty too, and I can imagine the implementation in Vala might not be so hard.

http://msdn.microsoft.com/en-us/library/bb383977.aspx

Is this something that has been considered and rejected before?
Comment 1 Simon Werbeck 2014-03-29 17:21:37 UTC
Created attachment 273242 [details] [review]
Add support for extension methods

I decided to implement the C# syntax, so one has to either add an [Extension] attribute or use `this' as modifier to the instance parameter. The only notable difference is that extension methods must be declared in namespaces (since Vala has no static classes) - this includes the root namespace.

Fixes bug 681097
Comment 2 Luca Bruno 2014-03-29 17:27:38 UTC
Thanks for the work. However rather than that ugly parameter, wouldn't it be possible to do something like:

extend Some.Class {
  public void method () { ... }
}
Comment 3 GNOME Infrastructure Team 2018-05-22 14:27:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/309.