Re: xcode 2.2 coredata accessors
Re: xcode 2.2 coredata accessors
- Subject: Re: xcode 2.2 coredata accessors
- From: mmalcolm crawford <email@hidden>
- Date: Tue, 15 Nov 2005 07:30:53 -0800
On Nov 15, 2005, at 1:54 AM, Aurélien Hugelé wrote:
if one of my entity attribute is a float or an int, why do my
accessors should return NSNumber ? there is no "nil" value here,
just 0.0 and 0 values...
They don't. Per Miguel's follow-up ("I'd say it's safe to continue
using the primitive accessors if they are more convenient for you and
you understand the issues with the handling of Nil values."),
continue to use scalars as before...
Moreover, I do a lot of arithmetic with my *entities* *scalar*
*attributes*, and having them as NSNumber is a real pain (until we
can do NSNumber + NSNumber :-D) so changing my accessors to return
NSNumber seems unreasonable.
Should I avoid implementing accessors and use valueForKey:
instead ? and i'll loose type checking, autocompletion and add many
typing errors ?
Again, continue to use scalars with your custom accessors.
mmalcom gave a link to NON STANDART attributes accessors... are
float considered non standart ??!!
For managed objects, yes -- the default is to use object values.
in listing 2 of this link : http://developer.apple.com/
documentation/Cocoa/Conceptual/CoreData/Articles/
cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154
Apple documentation explains how to implement a float accessor for
a *class* ivar, but no exemple about a float entity attribute.
Since day one, i implement them the same way, and now you want us
to change the implementation to return NSNumber ?
If you have no reason for using scalars other than "that's what Xcode
generated for me" then it would be better to switch to object
values. If you do have good reason for using scalars (as discussed
in the article) and you've taken account of null values, then
continue as before.
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden