Retyping parameters
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