Hi David, On Sunday, August 5, 2012, David Chisnall wrote:
> Hi Ivan, > > Your question is strange because @dynamic is the opposite of @synthesize. > If what you meant was 'can we use declared properties' then the answer is > that we've been able to with clang and the GNUstep runtime for ages, and > with GCC since 4.6. > > There is no such thing as 'runtime-generated @properties', the compiler is > responsible for generating these functions, although it does call out to > the runtime for some simple cases to avoid burning instruction cache for no > reason. Glancing over the CALayer class reference, they all look like > properties that will work with trivial @synthesized implementations. > Most definitely they would. Except, app developer-supplied CALayer subclasses can define additional animatable properties, then hand them off for run-time synthesis (as opposed to compile time synthesis) via @dynamic. Similar to what Core Data does: properties are not synthesized at compile time via @synthesize, nor are accessors implemented by the app developer. We could in theory suggest developers to simply @synthesize when compiling for GNUstep (our implementation doesn't distinguish between animatable and non-animatable layer properties), but we should aim for source-level compatibility where possible. > > Glancing over your last commit, I can't even begin to work out what you > think you are trying to do, but it looks like whatever it is you are not > doing it in a sensible way. Either you are confusing KVC with declared > properties, or you don't understand what @dynamic means. A CoreAnimation > implementation does not need these contortions. Core Animation implementation by itself does not. However, multiple books mention that new animatable properties can be added as described above. I pretty much would not support this if I designed an API from scratch. However -- if I understood docs correctly, that's the documented way to add new animatable properties. What I did in the commit you're commenting was pretty much the only way I found of adding accessor methods at runtime, and it being so convoluted is the exact reason why I decided to ask for tips. If someone has worked on adding accessor methods at runtime for properties that were marked with @dynamic, I wouldn't mind help. :-) More info on what behavior I'm trying to support: http://stackoverflow.com/questions/2395382/animating-a-custom-property-of-calayer-subclass and to an extent http://www.omnigroup.com/blog/entry/Animating_CALayer_content/ -- Ivan Vučica - [email protected]
_______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
