Skip navigation.
 
mlRe: Objective-C and it's future
FROM : Rob Ross
DATE : Sat Jul 08 03:18:44 2006

On Jul 7, 2006, at 6:07 PM, Shawn Erickson wrote:

> On 7/7/06, Damien Sorresso <<email_removed>> wrote:

>> On 7 Jul, 2006, at 7:29 PM, Rob Ross wrote:
>>
>> > I'm just learning Obj-C myself, so maybe my understanding is not
>> > correct. But, don't you actually have the option to use static
>> > typing in certain instances, and use dynamic typing in others?
>> >
>> > Eg:
>> >
>> > id    myStr;
>> >
>> > vs
>> >
>> > NSString *myStr;
>> >
>> >
>> > Won't the second version give you the benefits of static typing
>> > (compiler time checking)?
>> >
>>
>> Well, kinda sorta. The compiler will check, but the messages are
>> still bound at runtime. For example, this statement won't even
>> generate a warning.
>>
>> NSString *str = [[NSData alloc] init];
>>
>> because both `NSData' and `NSString' have `init' methods, and `init'
>> methods return an object of type `id', which is NOT statically typed.

>
> ...but the point is you could implement classes that are specific
> about what they return (I often do that with my init methods) and the
> compiler would flag this for you.


Are you saying you can write an init method with a signature like this:

- (FooClass *)init;

I thought that if you overrode a method from a superclass, the 
signatures must match (including the return type).

Or am I wrong about that?

Rob

Related mailsAuthorDate
mlObjective-C and it's future Thomas Davie Jul 8, 01:33
mlRe: Objective-C and it's future Finlay Dobbie Jul 8, 01:46
mlRe: Objective-C and it's future Shawn Erickson Jul 8, 01:48
mlRe: Objective-C and it's future Charlton Wilbur Jul 8, 01:55
mlRe: Objective-C and it's future Thomas Davie Jul 8, 02:10
mlRe: Objective-C and it's future Robert Walker Jul 8, 02:12
mlRe: Re: Objective-C and it's future Shawn Erickson Jul 8, 02:22
mlRe: Objective-C and it's future Rob Ross Jul 8, 02:29
mlRe: Re: Objective-C and it's future Shawn Erickson Jul 8, 02:41
mlRe: Objective-C and it's future Thomas Davie Jul 8, 02:42
mlRe: Objective-C and it's future Erik Buck Jul 8, 02:50
mlRe: Objective-C and it's future Kenny Leung Jul 8, 02:57
mlRe: Objective-C and it's future Gregory Weston Jul 8, 03:00
mlRe: Objective-C and it's future Damien Sorresso Jul 8, 03:00
mlRe: Objective-C and it's future Damien Sorresso Jul 8, 03:00
mlRe: Re: Objective-C and it's future Shawn Erickson Jul 8, 03:07
mlRe: Objective-C and it's future Thomas Davie Jul 8, 03:12
mlRe: Objective-C and it's future Damien Sorresso Jul 8, 03:14
mlRe: Objective-C and it's future Rob Ross Jul 8, 03:15
mlRe: Objective-C and it's future Rob Ross Jul 8, 03:18
mlRe: Re: Objective-C and it's future Shawn Erickson Jul 8, 03:23
mlRe: Re: Objective-C and it's future Shawn Erickson Jul 8, 03:25
mlRe: Objective-C and it's future Thomas Davie Jul 8, 03:28
mlRe: Objective-C and it's future Thomas Davie Jul 8, 03:40
mlRe: Objective-C and it's future Sherm Pendley Jul 8, 03:54
mlRe: Objective-C and it's future Kenny Leung Jul 8, 03:56
mlRe: Objective-C and it's future Shawn Erickson Jul 8, 04:22
ml[Moderator] Re: Objective-C and it's future cocoa-dev-admins Jul 8, 04:56
mlRe: Objective-C and it's future Thomas Davie Jul 8, 13:10
mlRe: Objective-C and it's future listposter Jul 8, 17:02
mlRe: Objective-C and it's future cocoa-dev-admins Jul 8, 17:05
mlRe: Objective-C and it's future John C. Randolph Jul 8, 18:50
mlRe: Objective-C and it's future Ryan Stevens Jul 8, 19:13
mlRe: Objective-C and it's future Scott Thompson Jul 10, 16:21
mlRe: Objective-C and it's future Andrew Satori Jul 10, 16:43
ml[Modertator] Re: Objective-C and it's future cocoa-dev-admins Jul 10, 17:13