Re: [Vala] I'm missing Java's anonymous classes
- From: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
- To: Vala Mail List <vala-list gnome org>
- Subject: Re: [Vala] I'm missing Java's anonymous classes
- Date: Sat, 6 Aug 2011 09:35:54 +0800
The compiled code is something like this (from memory):
self = uazu_win_widget_construct(uazu_win_display_relayout_imp, self);
i.e. the delegate is a dual-pointer (func, target), with 'self' as the
second part. But 'self' hasn't yet been initialised, because the
widget constructor call hasn't yet been made, so NULL is passed.
This is interesting. I can't blame the vala developers
for missing this one (or perhaps already considering
and dismissing it). Consider directly constructing a Widget
accepting its own method as a delegate:
var x = new Widget (x.foo !!!!????);
There is no way that the Vala compiler can make this work, as far as I
can see. A delegate which depends on 'self' can never be passed to a
constructor.
I think this can be fixed a using a separate alloc step
(like in objective-c?).
hand
Nor Jaidi Tuah
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]