Hi,
I know that there has been some discussion on this subject. Reading
through [1] and [2] I tried the following approach to pass a delegate
method to a class and to execute it there like:
public class MyClass : GLib.Object {
public delegate void Handler ();
public MyClass (Handler? handler) {
this.handle = (owned)handler;
}
public void execute_handler () {
if (handle !=null ) {
handle ();
}
}
Now, the issue is, that passing the delegate like
this.handle = handler
gets me the "copying delegates is discouraged" warning but it works,
trying to transfer the ownership like in the snippet above gives me a
compiler error: "No reference to be transferred". The other option to
use:
unowned Handler this.handle = handler
gives me a "syntax error, expected ';'"
What am I missing? Any enlightenment appreciated...
Thanks
[1] https://mail.gnome.org/archives/vala-list/2011-June/msg00061.html
[2] http://valajournal.blogspot.com/2011/06/vala-0130-released.html
--
tomw <[email protected]>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list