【发布时间】:2014-08-12 16:25:40
【问题描述】:
Vala Tutorial 有一个example about DBus using anonymous methods。
Bus.own_name (BusType.SESSION, "org.example.DemoService", /* name to register */
BusNameOwnerFlags.NONE, /* flags */
on_bus_aquired, /* callback function on registration succeeded */
() => {}, /* callback on name register succeeded */
() => stderr.printf ("Could not acquire name\n")); /* callback on name lost */
我正在尝试在 Genie 中重写此代码,但无法转换最后两行。 Genie Tutorial 只有an example on how to use a closure to define an event handler。
f.my_event += def (t, a)
print "event was detected with value %d", a
如何在 Genie 的方法调用中使用匿名方法定义?
【问题讨论】:
标签: lambda closures vala genie