Hi Matthias,

> Well, apparently storing objects in a List is esoteric,
> because the compiler will let obvious type errors pass:
> 
>  var l1 = new ArrayList<Foo>();
>  ArrayList<Object> l2 = l1;
>  l2.add(new Object());
>  Foo f = l1[0]; // f has type Foo but points to an Object, no cast is needed.
> 
> And apparently creating a delegate that takes a generic type as an argument is
> also esoteric, because that makes the compiler crash:
>  class Foo<T> {
>    public delegate void del(T t);
>    public del bla() {
>      return y => {};
>    }
>  }
> 
> Bindings to C functions with a generic type are obviously something only a
> poser would do. Surely that's the only reason why simple_generics was added:
> [CCode(simple_generics = true)]
> extern GLib.HashTable<K, V> g_hash_table_ref<K, V>(GLib.HashTable<K, V> ht);
> Calls to a function defined like this will lead to broken C code being 
> generated.

Thanks – these look like valid issues to me.
Could we burden you with opening bugs for those issues or did you already?

Cheers,

:M:

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to