On Feb 23, 2014, at 3:30 AM, [email protected] wrote:

> 3. For any given object subclass (of which there may be many) I want  
> -objCType to be constant.
> 
> I think that NSNumber does all of the above. Ken believes that 3. is in doubt.
> If this proves to be the case then I will have to go down the custom class 
> route.

I don't know why that should be for "any given object subclass" rather than for 
"any given value".  Also, I don't have to prove it may differ.  I only have to 
point out that there's no guarantee that it will be constant.  No amount of 
empiricism can establish that guarantee.  Without a design contract, things may 
always change at any time.

As it happens, it's easy to prove:

[[NSNumber numberWithChar:-5] objCType] -> "c"
[[NSNumber numberWithShort:-5] objCType] -> "s"
[[NSNumber numberWithInt:-5] objCType] -> "i"
[[NSNumber numberWithLong:-5] objCType] -> "q"

All of these number objects compare equal and will thus be interchangeable as 
dictionary keys in Cocoa.  But they won't have the same representation in your 
scheme and so will fail to compare equal in Mono.

Tested on OS X 10.6.8.  Results may differ on other versions of the OS.

-Ken


_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to