• 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: Nullability annotation "best practice"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nullability annotation "best practice"


  • Subject: Re: Nullability annotation "best practice"
  • From: Seth Willits <email@hidden>
  • Date: Sun, 16 Aug 2015 09:10:45 -0700

Really? This list has no opinions? That's hard to imagine :-)


--
Seth Willits



> On Aug 8, 2015, at 1:15 PM, Seth Willits <email@hidden> wrote:
>
> Let's stipulate that _Nullable and _Nonnull are great to have because they can catch bugs and express API intent better than before, so we want them. The question is where to put them?
>
>
> _Nullable and _Nonnull make perfect sense to specify in the @interface. Since those annotations existing in the @interface will produce applicable warnings and errors in the counterpart @implementation,there's really no _need_ to respecify them in the @implementation of those same methods.
>
> It makes sense for private methods to have nullability annotations for all the same reasons public Now let's assume that private methods aren't specified in any @interface, even the anonymous one. In that case, those methods would naturally have no annotations on their parameters or return values unless they're specified within the @implementation. But specifying them on the private methods in the @implementation while *not* specifying them for the public methods in the @implementation is inconsistent and potentially confusing.
>
>
> So I see two choices here:
>
> 1) Always add nullability annotations, for all methods and properties in both the @interface and @implementation. (Private methods may or may not be declared within @interfaces — but these days I think it's generally not done?)
>
> 2) Only add nullability annotations in the @interface, and always declare private methods within an @interface.
>
>
>
> Is there a third choice I'm not thinking of?
>
>
> Thoughts? I'm curious how Apple is adopting these annotations themselves.
>
>
>
> --
> Seth Willits
>

_______________________________________________

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: Nullability annotation "best practice"
      • From: Quincey Morris <email@hidden>
References: 
 >Nullability annotation "best practice" (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Thread-safe atomic property for array
  • Next by Date: iOS 9 features in iOS 8 targeted projects with swift #availability check
  • Previous by thread: Nullability annotation "best practice"
  • Next by thread: Re: Nullability annotation "best practice"
  • Index(es):
    • Date
    • Thread