Re: [Vala] self-less delegates
- From: "Juerg Billeter" <j bitron ch>
- To: "Stephen Sinclair" <radarsat1 gmail com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] self-less delegates
- Date: Mon, 26 May 2008 10:49:17 +0200 (CEST)
On Mon, May 26, 2008 01:29, Stephen Sinclair wrote:
On Sun, May 25, 2008 at 5:34 PM, Jürg Billeter <j bitron ch> wrote:
Anyways, The new_method function does not take any parameters.
However, in trying to use "delegate" to create this callback, I found
that it always seems to add an argument, gpointer *self. This makes
some sense for most callbacks, but in this case the callback does not
take any parameters.
Use the `static' modifier when declaring the delegate, this prevents the
generation of the user_data / target_object parameter.
Thanks, that worked perfectly!
I thought I'd tried all combinations of the static keyword, but I
guess I missed that one. While it does make sense that "static" would
work here, what do you think of the idea that delegates described
outside a class should not have the context argument?
Delegates are often declared outside classes but still used for instance
methods, so we don't want to default to no context there. However, I agree
that the `static' modifier can be misleading as it usually has a slightly
different meaning. That's why I'd like to replace it by an attribute, see
http://bugzilla.gnome.org/show_bug.cgi?id=526549
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]