On Sun, Feb 19, 2012 at 5:32 AM, Matto Marjanovic mad...@mir.com wrote:
Are there any plans to add type bounds to Vala generics?
This would allow something like (e.g., using Java's keyword):
public int get_lengthT extends string (T val) {
return val.length;
}
Yes, but not anytime soon.
Apologies for my confusedf terminology. I'm meeting with repeated
abysmal failure trying to bend generics to my will.
Going back to basics, I started with the example code at
https://live.gnome.org/Vala/Tutorial#Generics.
I had to rename set_data() and get_data() to get this to compile, but
On 02/18/12 15:10, ant wrote:
On 18 February 2012 21:56, Evan Nemersone...@coeus-group.com wrote:
public int get_lengthT (T val) {
if ( typeof (T) == typeof (string) ) {
return ((string) val).length;
} else {
GLib.error (Unable to handle type `%s', typeof (T).name ());
}
}