Wouldn't it be nice to do a:
int a = [myArray objectAtIndex:0];
and get the object stored in the NSArray sent an -intValue? Yes, we
could invent a new language for this, but I don't think its necessary
in practice and would be quite a waste of time.
Well it's kind of nice except that the compiler can't know that the
objects in the collection implement intValue.
Actually this is no different to
The compiler might issue a warning (unlikely in this case) and if you
want to have it more explicit, use a cast to eg 'NSNumber *'.
So that line would have to compile without warnings and possibly throw
an exception when intValue is called on an object that doesn't support
it during run time.
Yup, thats how things are done in Objective-C. We already have such
implicit selectors for @throw, @"abc" etc.
I like Objective-C for how explicit it is compared to C++. You'd
also need to add other implicit type conversion like float, double,
long long, etc.
Yup, we already have all that in NSNumber. With Obj-C its still the
task of the developer to make useful things with the language :-)
And what do you do with:
char *nullTerminatedString = myStringObject;
Send -charValue to myStringObject. Kinda obvious ;-)
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden