Re: [Vala] vala-list.gnome.org



On Wed, Nov 18, 2009 at 10:04:20AM +0100, pancake wrote:
Just use the full name with namespaces:

new Gee.ArrayList...

I have faced this situation some mNy times and wonder if vala
supports a way to specify which classes priorize in short name from
which namespace.
I also see a problem here, especially considering that future
additions to one package could break code which currently
works. For example, a.vapi provides function f(), and now
b.vapi gets it aswell: code using a.vapi and b.vapi breaks.

A simple partial solution is to always use the last imported
class and print a warning if the class is defined in multiple
modules. It still does not solve the problem when a function
does different things in different vapis.

One thing where we may be affected by this is glib-2.0 and
posix, which could both provide open() (glib being g_open
in C, but open() in Vala). Adding open() to glib-2.0 would
even break applications with just
        using Posix;
        [...]
        open(...);
since everything from GLib can be considered global and the
both open() function would conflict.


Something like this will be good to have in the language:

using Gee (ArrayList);

So if you useArrayList in the code. The compiler will get it from
Gee. Likethe from import syntax in python or the static import in
java.
or doing it the C# way of:
        using ArrayList = Gee.ArrayList;
Which explains itself very well.



-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.



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