[cfe-dev] Objective-C really strong type checking

Jesper wootest at gmail.com
Thu Sep 9 10:15:46 PDT 2010


>> Maybe you missed the point: there's NSMutableArray object assigned to
>> attribute of NSMutableDictionary type, and those types have completly
>> different interfaces. If the programmer would realy want this, he could use
>> attribute of type 'id' and live with possibility of runtime errors.
>
> So, this is more than just warn on assigning an 'id' expression to a static
> type. Checker should treat  [NSMutableArray new] specially and see how it
> gets used.

I think it's about assigning a specified object type (which +new and
-init... are by convention) to a non-id variable that's not derivative
of the object type. NSMutableArray "is-not-a" NSMutableDictionary, but
by convention +new and -init... return id to mean an instance of this
type or a derived type (or possibly something that proxies to either).

/Jesper
[accidentally sent this to Fariborz and not to the list]




More information about the cfe-dev mailing list