Re: What are the limitations of Dot Syntax?
Re: What are the limitations of Dot Syntax?
- Subject: Re: What are the limitations of Dot Syntax?
- From: "Clark Cox" <email@hidden>
- Date: Fri, 5 Dec 2008 20:03:49 -0800
On Fri, Dec 5, 2008 at 7:55 PM, Jerry Krinock <email@hidden> wrote:
>
> On 2008 Dec, 05, at 18:40, Chris Hanson wrote:
>
>> Dot syntax compiles to objc_msgSend* just like bracket syntax does.
>> However, it must see either getter/setter declarations or an @property
>> declaration to know what selector to put in the objc_msgSend* that it
>> compiles to.
>
> I understand why this must be so, but it makes the dot syntax difficult to
> use in practice. When writing a message, I have to stop and think, "Gee did
> I declare that as a property or not?"
What makes you think that. Whether it's a getter called "foo" or a
@property called "foo", there is nothing wrong with using obj.foo to
call it.
> If I'm not sure, and have to click to
> my documentation, it's faster to just put in the square brackets.
>
> Also, it seems to me that that dot syntax makes more fragile code. For
> example, say that I declare a 'name' property. Then, next week I decide
> that I need a more granular name, so replace this property with a firstName
> and lastName property, and a -name accessor which concatenates firstName and
> lastName.
>
> If I had accessed 'name' in other files using the square bracket syntax,
> everything is still OK. But if I had accessed it using the dot syntax, I
> now have dot abuse.
Why do you think that would be "abuse"? (It's not.)
--
Clark S. Cox III
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden