• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: dot syntax issue? (Newb Question?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dot syntax issue? (Newb Question?)


  • Subject: Re: dot syntax issue? (Newb Question?)
  • From: Ali Ozer <email@hidden>
  • Date: Thu, 8 Nov 2007 09:37:58 -0800

It would, but in general it's really not a good idea to be adding categories or properties on kit classes (just for this kind of purpose) since it may conflict with @property declarations Apple may introduce in the future.

If the dot syntax doesn't work for some reason or another, the best approach may be to stick to the bracket syntax for now.

Ali


On Nov 8, 2007, at 09:28 , John Stiles wrote:

Just a random hypothetical: if one were to add a category on NSStatusItem and implement -enabled (and have it call through to - isEnabled), would that enable dot-syntax for the enabled property?


On Nov 8, 2007, at 9:23 AM, mmalc crawford wrote:


On Nov 8, 2007, at 9:08 AM, Gregor Brandt wrote:

statusItem.menu = mainMenu; // works fine
statusItem.enabled = YES; // error: request for member 'enabled' in something not a structure or union
statusItem.highlightMode = YES; // works fine

NSStatusItem defines:

- (BOOL)isEnabled;

(not -enabled).

Can someone explain to me why enabled does not exist in the NSStatusItem.h

The implementors chose to store the information somewhere else.
The implementation detail should not be a concern to you -- you should be using the public API (maintaining encapsulation).



and why NSStatusItem.h does not use @property for its properties?

It precedes the introduction of properties. Most classes have not been retrofitted.

In general, you are encouraged to use the dot syntax only with actual properties...

mmalc

_______________________________________________

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

_______________________________________________

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

_______________________________________________

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


References: 
 >dot syntax issue? (Newb Question?) (From: Gregor Brandt <email@hidden>)
 >Re: dot syntax issue? (Newb Question?) (From: mmalc crawford <email@hidden>)
 >Re: dot syntax issue? (Newb Question?) (From: John Stiles <email@hidden>)

  • Prev by Date: Re: dot syntax issue? (Newb Question?)
  • Next by Date: Re: dot syntax issue? (Newb Question?)
  • Previous by thread: Re: dot syntax issue? (Newb Question?)
  • Next by thread: Re: dot syntax issue? (Newb Question?)
  • Index(es):
    • Date
    • Thread