• 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
Retyping parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Retyping parameters


  • Subject: Retyping parameters
  • From: "Theodore H. Smith" <email@hidden>
  • Date: Fri, 1 Jul 2005 14:17:23 +0100

I've found out that I can re-type parameters, and the code compiles and seems to work just as well.

For example the NSOutlineView's delegate method:

outlineView:isItemExpandable:

I can implement like this:

- (BOOL)outlineView:(NSOutlineView *)ov isItemExpandable: (TaxonomyNode*)item {
if (item == nil) { return true; }
return [item expandable];
}


Here, I have declared item to be "TaxonomyNode*" instead of an "id".

I am just asking, is there any reason to avoid doing this? It appears that ObjC only looks for the method name in figuring out a selector, not the method types, so I can't see any reason why not to do it. But I don't know Cocoa very well so I'm sure someone else here will know for sure.

Also, do you think it's worthwhile doing? I happen to like strong typing, at least for code-completion's sake :)

--
http://elfdata.com/plugin/ Industrial strength string processing, made easy.


"All things are logical. Putting free-will in the slot for premises in
a logical system, makes all of life both understandable, and free."

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Newbie Questions re NSDecimal
  • Next by Date: Re: Using gcc 2 on 10.4.1 with XCode 2.1. Confirmation request.
  • Previous by thread: Newbie Questions re NSDecimal
  • Next by thread: Re: Retyping parameters
  • Index(es):
    • Date
    • Thread