Re: [Vala] [RFC] Extension methods (Re: maemo5 hildon input mode)
- From: Jan-Jaap van der Geer <jjvdgeer inbox com>
- To: vala-list gnome org
- Subject: Re: [Vala] [RFC] Extension methods (Re: maemo5 hildon input mode)
- Date: Wed, 10 Feb 2010 02:34:29 -0800
Jan Hudec <bulb ucw cz> wrote:
This looks like another use-case for extension methods in a day.
I'd like to see them as well.
namespace Moo {
bool less_or_equal(IComparable this lhs, IComparable rhs) {
return !rhs.less_than(lhs);
}
}
The C# syntax is actually a little bit different: You need to swap the type and "this":
namespace Moo {
bool less_or_equal(this IComparable lhs, IComparable rhs) {
return !rhs.less_than(lhs);
}
}
I feel like we should follow C# regarding that. In C# the method must be static and must be placed in a
static class as well.
Cheers,
Jan-Jaap
____________________________________________________________
GET FREE 5GB EMAIL - Check out spam free email with many cool features!
Visit http://www.inbox.com/email to find out more!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]