Re: [Vala] Fwd: Re: GenericArray problem



Thanks Daniel, and I agree an empty subclass of a generic mostly works -
but not with GenericArray for some reason.  A direct specialisation of
GenericArray works fine, but if one creates a subclass as indicated, the C
comipler error appears in the compilation of the subclass definition.

I wonder if anyone has suggestions as to why GenericArray should
demonstrate this behaviour?

Also I note that the doco for GenericArray indicates that it takes a
defaulted initial size parameter, but it appears that it just ain't so -
giving an initial size causes a compilation error on too many args.

On Sat, Oct 17, 2015 at 11:58 PM, Daniel Espinosa <esodan gmail com> wrote:

---------- Mensaje reenviado ----------
De: "Daniel Espinosa" <esodan gmail com>
Fecha: oct. 17, 2015 7:58 AM
Asunto: Re: [Vala] GenericArray problem
Para: "Andy Lees" <andrewl oz gmail com>
Cc:

In LibreSCL (www.librescl.org) I just declare an empty class derived from
a
generic one, this makes to call

var a = new Intclass ();

Just works.

If you want a binding friendly class definition you should define your own
get/set methods returning the actual value type not a generic, as in:


https://github.com/powerwaremediacore/librescl/blob/master/librescl/tDA.vala

I plan to add iterator methods to collections, this will allow bindings to
use them on loops. Because we relay on Gee, its iterators are generic
making hard/impossible to use on GObject Introspection bindings.
El oct. 16, 2015 6:22 PM, "Andy Lees" <andrewl oz gmail com> escribió:

Hi,

If I declare a derived class of GenericArray, like so:

public class IntArray : GenericArray<int> {
  public IntArray() {
  }
}

I get a gcc error, like so:
/tmp/a.vala.AH856X.c: In function ‘int_array_new’:
/tmp/a.vala.AH856X.c:66:2: error: too few arguments to function
‘g_ptr_array_new_with_free_func’
  self = (IntArray*) g_ptr_array_new_with_free_func ();

whereas with Array (for example) it just works.

Is there something I'm doing wrong, or is this a bug?

Using Vala 0.30.0

Regards,

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

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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]