There is no requirement that the parameter names in the @interface match the parameter names in the @implementation.

It will generally make reading the code easier if you don't give senseless names to things, and use a coherent naming approach, but the compiler won't care. It's just a symbol, and the only thing the compiler needs is for it to follow the rules for naming symbols.

The following works fine: <snip>
There is no requirement that the parameter names in the @interface match the parameter names in the @implementation.

It will generally make reading the code easier if you don't give senseless names to things, and use a coherent naming approach, but the compiler won't care. It's just a symbol, and the only thing the compiler needs is for it to follow the rules for naming symbols.

Click to expand...

Right, but I just like it that way for making the code easier to read.

Staff Member

There is no requirement that the parameter names in the @interface match the parameter names in the @implementation.

Click to expand...

Sorry for the confusion. Perhaps a poor choice of words on my part. I wasn't meaning to imply that the @interface and @implementation needed to match, but that you had to be consistent within the @implementation.

The issue is scope, parts, and consistency within the scope of a particular part. Maybe something like "each part must be self-consistent", but that leaves "part" pretty vague. "Each method must be self-consistent", but the principle applies to more than just methods.

"Each context" is also pretty vague, and hard to pin down because contexts are hierarchical: there is a context in which instance variables are "in scope", and that context continues across all the methods within an @implementation/@end grouping. There's also a "global context" that would encompass any extern variables, class declarations, etc.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.