Re: [Vala] How do you get from the generic, to the.....specific?

2012-02-19 Thread Luca Bruno
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.

[Vala] How do you get from the generic, to the.....specific?

2012-02-18 Thread ant
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

Re: [Vala] How do you get from the generic, to the.....specific?

2012-02-18 Thread Matto Marjanovic
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 ()); } }