Re: [Vala] delegates + struct initializer problem



في ث، 15-03-2011 عند 01:53 +0300 ، كتب Maga Abdurakhmanov:
Hi!
I'm using structure with delegate field. When I assign that field with
structure initializer, then call to delegate is failed.
Am I doing something wrong or is this a bug in vala? Here is the code
demonstrating problem:

delegate void func();

class test_class : Object {

public void method() {
stdout.printf("method is called\n");
}
}

struct wrapper {
unowned func f;
}

int main(string[] args) {
var t = new test_class();
 wrapper w = { f : t.method };

Well, I don't know this syntax. So either it's some obscure syntax that
is buggy, or it is a coincidence that you program compiles. Either way,
this is a bug in the compiler (it should either generate correct code or
report an error).

Anyway, the more conventional syntax
  wrapper w = wrapper () {f = t.method};
works.

HTH,
Abderrahim




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