• 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: Loading 2 classes with same name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading 2 classes with same name


  • Subject: Re: Loading 2 classes with same name
  • From: j o a r <email@hidden>
  • Date: Fri, 8 Aug 2003 07:46:12 +0200

On Friday, August 8, 2003, at 02.47, Wade Tregaskis wrote:

I have read that when loading a class that already has that name in use that the behavior is undefined.

Loading the same class twice will usually crash your app. If you've managed to load a class that already existed in the app without crashing, you got lucky.

What would happen then if your app loads a bundle that includes a conflicting class name, possibly from a previous bundle? Isn't poor behavior to crash a whole app because of one bundle? Surely some other action could be taken, like just using the existing class, raising an exception, etc etc.

One thing you can do before loading the bundle is use NSBundle to check the principal class key. This should give you some clue as to wether you'll clash or not, and is one of the few things you can check without having to load the bundle. Granted, it only gives you information about the class name of one class in the bundle...
Otherwise I think that this is something that you need to think of as a plugin / bundle developer. Prefix your custom class and method names properly!

File a bug if you don't think that this is good enough.

j o a r
_______________________________________________
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.

  • Follow-Ups:
    • Re: Loading 2 classes with same name
      • From: Scott Anguish <email@hidden>
References: 
 >Re: Loading 2 classes with same name (From: Wade Tregaskis <email@hidden>)

  • Prev by Date: Re: IB Woes
  • Next by Date: [ANN] ResKnife 0.5d1
  • Previous by thread: Re: Loading 2 classes with same name
  • Next by thread: Re: Loading 2 classes with same name
  • Index(es):
    • Date
    • Thread