I'd really like to read a reply to Lucio's argument about operator overloading.
Once we define that:
1. a<b is syntactic sugar for a.Less(b) (with a and b being of the same type);
2. a==b is the same as a.Equals(b);
3. the other comparaison operators are defined using these two (e.g.: a>b is
!a.Less(b) && !a.Equals(b));
4. a.Index(b) is the same as a[b] and a.Index2(b, c) is the same as a[b:c];
5. maybe some more?
Would we really need contracts and the added complexity in this case?
Shouldn't slightly extended interfaces suffice?
E.g.:
type comparer(type T) interface {
Less(other T)
}
func min(type T comparer)(a, b T) {
if a < b {
return a;
}
return b;
}
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.