Re: Properties and the runtime



So, if I declared a property called money and synthesized said property, would [object setMoney:money] and object.money = money compile to the same code? That, of course, implies that we're also inserting property-related code to simple method calls if they happen to correspond with a property.

Also, same question for if I declared a property and didn't synthesize (wrote my own getter/setter).

Luke

On Mar 29, 2009, at 10:15 PM, Bill Bumgarner wrote:

On Mar 29, 2009, at 10:06 PM, Luke the Hiesterman wrote:
I can't think of anything about properties that needs to be dealt with at runtime. My understanding has it that all information necessary for what properties do is available at compile time. E.g. the method to call, return types, how to compile synthesized properties using copy, retain, assign, nonatomic, and also whether to throw an error if something is readonly. So, then, my question is, what about using properties requires a runtime component? To me it feels like everything could be handled by the compiler.

The compiler emits code that calls runtime API to implement the mechanisms behind the setter/getter very efficiently and with minimal code duplication. This includes support for code that can run both GC and non-GC, as well as atomic vs. nonatomic.

b.bum


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx

...



Privacy