Le 20 mai 08 à 00:06, Peter Duniho a écrit :

C# provides "partial" class implementations for when you want to split functionality across multiple module files (one use of categories).

As you wrote, this is one use of categories. However, it is not this usage that makes categories so powerful. It is the possibility to add methods to classes for which you don't have source code (i.e., that have been compiled by someone else). C# partial classes require you to have all of the class source code (all the "partial" chunks) when compiling your class.

When you are accessing only the public API for a class, C#'s extension methods provide the same sort of syntax,

Yes, but the semantic is completely different. In C#, extension methods are actually not instance methods or class methods : no dynamic binding takes place at invocation time. All is statically resolved at compile time. It is syntactic sugar for static "methods".

Philippe Mougin
http://www.fscript.org
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to