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



On 08/01/2009 04:36 PM, Łukasz Pankowski wrote:
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
}

I and Julien proposed that, but juergbi closed it as WONTFIX without discussion.
Maybe if more people express their opinion, we could change his mind?

See this bug: http://bugzilla.gnome.org/show_bug.cgi?id=586486




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