Re: [Vala] Switch statement on GType.



Under Vala 0.6 the following worked.

switch (tree_store.get_column_type (n)) {
    case typeof(string):
        ...
    break;
}


In Vala 0.7 it does not -- error: Integer or string expression expected.

Should it actually be 'error: Integer or string literal expected.'?

I was unclear. I feel there should be no error since GType is really
an unsigned long. In the gobject vapi "Type" derives from "ulong" so
it should be substitutable for ulong wherever ulong is expected, even
in switch statements. Switching on type seems like a run-time
operation that should be reasonably supported without a cast,
especially since the GType machinery already works with integer type
names.

-Sam



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