On 22 Apr '08, at 8:19 AM, Dave Camp wrote:

The problem is that I get the warning "initialization from distinct Objective-C type" when I do this, because the NSNumber class methods return a specific type instead of id.

It's safe; you'll just need to cast the return value to (NSDecimalNumber*) to avoid the warning.

I'm not sure I'd call this a bug in the headers. Most statically-typed OOP language have this kind of problem handling methods that are overridden to return a subclass instance. They could change the return type to "id", as other classes like NSDictionary do, but then you lose the type-checking. (There are several times I've accidentally assigned [NSMutableArray array] to an NSSet*, for example, and wasted time tracking down weird exceptions at runtime.)

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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