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

Re: Subclass


  • Subject: Re: Subclass
  • From: Chris Hanson <email@hidden>
  • Date: Sun, 15 Jun 2003 18:03:20 -0500

On Sunday, June 15, 2003, at 05:17 PM, Eric Wang wrote:
Just curious, what do you mean by cleaner category semantics? All your other
suggestions would be welcome additions to Objective-C, especially support
for unloading classes.

I mean two things: There should be no way to get undefined behavior using common idioms, and categories should be first-class objects. I think the two are (or can be) related.

Specifically, what happens when I have the following:

@interface Foo : NSObject
{}
@end

@implementation Foo
- (void)something {
NSLog(@"Foo something");
}

@implementation Foo (A)
- (void)something {
NSLog(@"Foo (B) something");
}
@end

@implementation Foo (B)
- (void)something {
NSLog(@"Foo (B) something");
}
@end

and I write [myFoo something]?

Also, it would be nice if -[Foo(B) something] could check to see if there were any other implementations of -something on Foo, and just delegate to one or more of those. Possibly even in a +loadCategory or +initializeCategory method.

It would also be nice for other objects to be able to ask for the categories on a class, and find out information about them like their name, what methods they implement, etc.

Right now, categories are fundamentally a hack. A very elegant and exceptionally useful hack, but still a hack. With some additional tweaks, though, categories could support full-bore Aspect Oriented Programming and Objective-C could be the first mainstream language to support it natively.

That would be great for plug-in development. Perhaps
you should file a feature request.

I have, and plug-ins are one reason why. The other is to support interactive development environments; if you subclass NSView in a Smalltalk environment that's bridged to Cocoa, and then you decide to change that subclass or get rid of it, what should happen? With real class unloading, it could just unload the class and (if you're changing it) load the new definition.

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Application Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Subclass (From: Eric Wang <email@hidden>)

  • Prev by Date: Re: View system usage with lower left origin
  • Next by Date: Managing different views for the same window
  • Previous by thread: Re: Subclass
  • Next by thread: Where to put writable files available to all users
  • Index(es):
    • Date
    • Thread