Re: NSNull and @""
Re: NSNull and @""
- Subject: Re: NSNull and @""
- From: "Kyle Sluder" <email@hidden>
- Date: Fri, 10 Oct 2008 23:18:05 -0400
On Fri, Oct 10, 2008 at 10:33 PM, Ian Joyner <email@hidden> wrote:
> So we must be dependent on testing, which I find compelling like agile
> programming, but ultimately very hit and miss.
Luckily the Developer Tools come with the OCUnit unit testing framework.
>> If it's a strong type system you seek, I suggest you look elsewhere.
>
> Insofar as strong typing helps software correctness, but as such, not
> necessarily strong typing. I appreciate the flexibility of dynamic
> languages, but one can have this also in strong typing.
Perhaps I should use the terms more correctly. ObjC is late-bound,
and *very* frequently Cooca will go and change the class identity of
the objects you're working with. A great example is KVO: if you
register as an observer of a MyObject, then KVO will actually
completely replace your MyObject instance with an instance of some
dynamically-generated _KVONotifyingMyObject class, and your code will
be none the wiser.
Essentially, you are giving up a lot of static analysis opportunities
in order to avoid the behavioral restrictions they impose. In this
case, you have mentioned NSNull in a context that is more familiar to
languages with well-developed type systems such as Haskell.
Objective-C foregoes this formal type system so that things like KVO
can function. It's a tradeoff, to be sure.
>> Like, somewhere other than desktop Macintosh software development,
>
> Why would I want to do that?
I'm not advocating that you do! It was a rhetorical device.
>> for
>> which all the popular languages have incredibly weak type systems.
>
> Popular does not necessarily imply good, only democratic.
I'm just noting that no reasonably well-supported development
environment on the Mac will provide you features such as a type system
in which a null type exists that is a subtype of all other types.
Pattern-matching languages, like Scala for example, are great for this
sort of thing, but you won't find one that is suitable for developing
desktop Mac applications. Perhaps that will change in the future.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden