gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mapping a setter to its @property


From: Ivan Vučica
Subject: Mapping a setter to its @property
Date: Mon, 13 Jul 2015 01:36:35 +0000

Hi David,

[cc gnustep-dev@ and Filip explicitly]

Filip is currently working on adding support for @dynamic properties to CALayer. http://badc0de.net/r/16

This is based on some very preliminary code I hacked together and #if'ed out two years ago.

Would you mind advising if there is some better way to runtime-generate these properties than what is currently being done -- iterating through them, then using class_addMethod() to add an implementation based on the type of the property? (I would be looking in the direction of NSValue to try and implement storage for other data types.)


Also, as the subject of the mail asks, the implementation currently uses _cmd to figure out the property name, then uses this to fetch or store a value in a dictionary. This will clearly break with a custom getter/setter name.

I'm not sufficiently familiar with the runtime to suggest something smarter. Would you mind suggesting an approach which would let us map a call to a setter onto the appropriate @property? Would a dictionary mapping a getter name to a property name plus a dictionary mapping a setter name to a property name be the right way to go? Or is there something wiser that can be done just with 'self' and '_cmd' in the shared getter/setter implementation?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]