[Vala] struct assignment



In C it's pretty common to do struct assignment like this:

typedef struct _Foo {
int a;
int b;
int c;
} Foo;

Foo thing = {1, 2, 3};

The problem is, once wrapped, you need to do the assignment field by field:
var thing = new Foo();
thing.a = 1;
thing.b = 2;
thing.c = 3;

The problem gets worse with things like this:

Foo[] thing = {{1,2,3}, {4,5,6}, {7,8,9}, ...};

Can't we sort this out somehow? Since valavapigen doesn't support class/struct extensibility (through - custom.vala files) I cannot even create a helper function with a sane name.

Any ideas?
--
Un saludo,
Alberto Ruiz

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