GNOME Bugzilla – Bug 668474
Support generic type constraints
Last modified: 2018-05-22 14:19:00 UTC
It would be nice if Vala supported constraints on generic types. I'm not exactly in love with the syntax C# uses, but they do it like this: http://msdn.microsoft.com/en-us/library/d5x73970(v=vs.80).aspx
Someone asked for the same feature in Stack Overflow: http://stackoverflow.com/questions/40692468/bounded-type-parameters-in-vala
*** Bug 694895 has been marked as a duplicate of this bug. ***
Created attachment 345031 [details] point class Hi, I was trying to write Generic Point<T> class , but I wasn't able to do some arithmetic operation and when I try to do so, I got error message says : error: Arithmetic operation not supported for types `T' and `T' That does make sence to me, since T is not knowen type and it could 'value-type' or 'reference-type' or anyother type, and as this bug says "constraints on generic types" would slove this issue, for example if I mark T to be value-type in my Point<T> class then I will be able to do arithmetic operation in Point<T> and that would be great. I have attached a testcase that (simplefide Point<T> class), you can see if needed.
-- 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/271.