• 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: Properties: A question of style
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Properties: A question of style


  • Subject: Re: Properties: A question of style
  • From: Steve Mills <email@hidden>
  • Date: Tue, 14 Jun 2016 20:55:55 -0500

> On Jun 14, 2016, at 20:51, Quincey Morris <email@hidden> wrote:
>
> FWIW, I prefer to use the other form for setters, too. I don’t see why:
>
>    self.animal = YES;
>
> is any improvement over:
>
>    self.isAnimal = YES;
>
> even when it’s something less concrete, say:
>
>    self.enabled = YES;
>
> vs:
>
>    self.isEnabled = YES;
>
> As far as I’m concerned, if the “is…” or “has…” form is better for getters, it’s better for setters too. (But it doesn’t seem like a religious matter.)

Why are you using a getter as a setter?

If(!self.isEnabled)
    self.enabled = YES;

Or:

If(![self isEnabled])
    [self setEnabled:YES];

Steve via iPad


_______________________________________________

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


  • Follow-Ups:
    • Re: Properties: A question of style
      • From: Quincey Morris <email@hidden>
References: 
 >Properties: A question of style (From: Graham Cox <email@hidden>)
 >Re: Properties: A question of style (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Properties: A question of style
  • Next by Date: Re: Properties: A question of style
  • Previous by thread: Re: Properties: A question of style
  • Next by thread: Re: Properties: A question of style
  • Index(es):
    • Date
    • Thread