GNOME Bugzilla – Bug 526549
Remove support for static delegates
Last modified: 2009-04-15 07:49:18 UTC
We currently use the 'static' modifier for delegates without a user_data parameter. I propose to replace the modifier by a CCode attribute for the following reasons: * A static delegate is just a limited delegate that doesn't have any advantages. The only reason we have static delegates is to support callbacks without user_data in bindings. It's more appropriate to use CCode attributes instead of modifiers for C-specific annotations. * In other places, the 'static' modifier is used as a member modifier that is relative to the parent type, e.g. static fields in a class are instance-independent, however, fields in a namespace are always instance-independent and don't require the 'static' modifier. The 'static' modifiers in delegate declarations don't follow the same rules.
Increase priority as it's an incompatible change.
This may be way out, but when I declare a delegate within a class definition I expect it to have a user data which has the type of the class. If it has the static modifier, or is declared outside of a class then I expect it not to have such a user data parameter. It makes sense to me, but I don't understand how this relates to the bug report. Sam
That's not how it's supposed to work. Delegates are usually not specific to a specific class, that is, you can use any object as user_data, and you often want to have user_data without putting the delegate into a class.
commit 3b5e848ec6ec8c0b454a144113de356394a0a89c Author: Jürg Billeter <j@bitron.ch> Date: Tue Apr 14 18:36:36 2009 +0200 Update bindings to not use static modifier for delegates
commit 1505848107f297e58e3c650777c4475f90a149b9 Author: Jürg Billeter <j@bitron.ch> Date: Tue Apr 14 18:33:44 2009 +0200 Replace static modifier for delegates by attribute Replace `static' modifier for delegates without a user_data parameter by [CCode (has_target = false)] as we only support this for bindings, it is not considered a language feature. Fixes bug 526549.