Hi, I'm wondering what the "official way" is that a compiler is supposed to use to disambiguate the following code:
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile: path]; NSArray *arr = [[NSArray alloc] initWithContentsOfFile: path]; Since alloc returns an id, in theory both NSArray's and NSDictionary's initWithContentsOfFile could be called by either statement. In order to determine whether the initWithContentsOfFile returns an NSDictionary* or an NSArray*, should the compiler check explicitly whether this message is sent to the result of a class message (or a class method called "alloc"), and if so use the class type of its target? And if that class type does not have any initWithContentsOfFile instance method, only then fall back to general "id"-based searching? Or is there a more general/different rule? Thanks, Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com This email sent to [email protected]
