Nor Jaidi Tuah wrote:
> > 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?).

Yes, good point -- that would work.

Jim

-- 
 Jim Peters                  (_)/=\~/_(_)                 [email protected]
                          (_)  /=\  ~/_  (_)
 UazĂș                  (_)    /=\    ~/_    (_)                http://
 in Peru            (_) ____ /=\ ____ ~/_ ____ (_)            uazu.net
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to