[Vala] How to lift the ambiguity between Gee.List and Glib.List ?



In the snippet hereunder, if I want to use Gee along with Glib, I have to
qualify the List with the namespace Glib to lift the ambiguity between
Gee.List and Glib.List.

However when doing it this way, I get the following error message at
compile time:

array.vala:2.7-2.10: error: The namespace name `Glib' could not be found
using Glib;
      ^^^^

although the corresponding package has been specified in the makefile:

valac --pkg=posix --pkg=glib-2.0 --pkg=gee-1.0 array.vala

I do not see how to get aroung this.

In other words, I do not see how to make use of Glib in this context.

One solution, of course is to omit the reference to Glib entirely (it is
implicit then), but then how does one lift the ambiguity between a
Glib.List and a Gee.List ?

Serge.




//=============

using Posix;
using Glib;
using Gee;


void prt (string x){
    Posix.stdout.printf("%s\n", x);
}


int comp (string a, string b) {
    return (Posix.strcmp(a, b));
}



int main (string[] argv) {

    Posix.stdout.printf("hello\n");

    var A = new Glib.List<string>();

    A.append("x");
    A.append("a");
    A.append("c");
    A.append("b");

    A.foreach (prt);
    A.sort(comp);

    Posix.stdout.printf("---\n");

    A.foreach (prt);

    return 0;
}

//=============


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