D on the Objective-C runtime?

Michel Fortin michel.fortin at michelf.com
Sun Sep 6 06:12:53 PDT 2009


On 2009-09-06 08:32:43 -0400, Christopher Wright <dhasenan at gmail.com> said:

> Off topic, but this would be a good place for user-defined attributes. 
> Then you could write something like:
> 
> @IBAction void openWindow(Object sender) {}

Indeed... although IBAction isn't so bad as a mixin, it gets much worse 
with ObjcMethod where it is necessary to list all the argument types to 
allow resolving overloaded functions:

	void doOneAndTwo(int i, int j) {}

	mixin ObjcMethod(void, doOneAndTwo, "doOne:andTwo:", int, int);

Compare to what could be done with a parametrized attribute:

	@ObjcMethod("doOne:andTwo:") void doOneAndTwo(int i, int j);

That'd would be a lot more convenient, especially with interfaces for 
which none of the mixin above can work (they insert some static struct 
member to store the "attributes").


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list