[Vala] wish for Type Inference working for weak local variables



Hello

According to the Vala tutorial

"Finally Vala has a mechanism called Type Inference, whereby a local
variable may be defined using var instead of giving a type, so long as
it is unambiguous what type is meant."

Type Interface works great for owned variables (for example in
declaration of variable b below) but not for weak variable (neither
declaration of c2 nor c3 works).

I would prefer just "weak" (as in declaration of c2) as shorter, but
maybe "weak var" would be more readable/discoverable?

What do you think about the idea?  Would this be hard to implement?


class Foo {}

void main ()
{
    // var for short
    Foo a = new Foo();
    var b = new Foo();

    // no `weak' for short    
    weak Foo c1 = a;
    weak c2 = a;                // syntax error
    weak var c3 = a;            // syntax error
}



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