[Vala] var + unowned



Hi all:

I'm creating a VAPI, and one of the constructors is defined as:

    public static unowned Icccm new(Xcb.Connection conn) {
        unowned Xcb.Icccm.Icccm retval = (Xcb.Icccm.Icccm)conn;
        return retval;
    }

The idea is to create an Icccm object that is, in fact, a Xcb.Connection object in disguise. The problem is that all these calls return an error:

    var icccm = Xcb.Icccm.new(this.conn);
    unowned var icccm = Xcb.Icccm.new(this.conn);
    var unowned icccm = Xcb.Icccm.new(this.conn);

and the only way to create a new object is using:

    unowned Xcb.Icccm.Icccm icccm = Xcb.Icccm.new(this.conn);

Am I doing something wrong, or really the vala compiler doesn't allow to use type inference and unowned types?

Thanks!

--
Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com



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