On 18 February 2012 21:56, Evan Nemerson <[email protected]> wrote:

Thanks for the comprehensive answer, it was most useful!

> You seem to be operating under a pretty fundamental (though
> understandable) misunderstanding about how Vala generics work.  This
> came up on stackoverflow recently, so you're not alone.

Heh, you're not wrong there!

> public int get_length<T> (T val) {
>  if ( typeof (T) == typeof (string) ) {
>    return ((string) val).length;
>  } else {
>    GLib.error ("Unable to handle type `%s'", typeof (T).name ());
>  }
> }

Thanks, that's exactly what I was after.

cheers
ant
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to