• 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: Programming Style: Method Definition with or without a semicolon.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programming Style: Method Definition with or without a semicolon.


  • Subject: Re: Programming Style: Method Definition with or without a semicolon.
  • From: Sander Stoks <email@hidden>
  • Date: Fri, 16 Oct 2009 09:17:33 +0200

Hello,

If it's a feature, then it's definitely a new one since the original specification of Objective-C. It turned out to be surprisingly hard to find that specification, but I found a grammar description here: http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Concepts/ObjectiveC/B_Grammar/Grammar.htmld/index.html

There it says:

instance-method-definition:

GIF image

GIF image

[ method-type ] method-selector [ declaration-list ] compound- statement

method-selector:

GIF image

unary-selector

GIF image

keyword-selector [ , ... ]

GIF image

keyword-selector  [ ,  parameter-type-list ]

The declaration-list and compound-statement are not specified further and are taken from the C spec. In other words: There's no semicolon.

On the other hand, the grammar spec has been removed from Apple's documentation, and I suppose the official line is now "Objective-C is whatever we ship with Xcode."

--Sander

1) I've seen an alternative way of defining a method, with the
semicolon after the declaration, before the body:

- (NSArray *)sortedIncredients;   <-- notice the semicolon
   {
      ...
   }
_______________________________________________

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: Programming Style: Method Definition with or without a semicolon.
      • From: Bill Bumgarner <email@hidden>
  • Prev by Date: Re: Programming Style: Method Definition with or without a semicolon.
  • Next by Date: Re: Record and Playback immediately
  • Previous by thread: Re: Programming Style: Method Definition with or without a semicolon.
  • Next by thread: Re: Programming Style: Method Definition with or without a semicolon.
  • Index(es):
    • Date
    • Thread