• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSNull and @""
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNull and @""


  • Subject: Re: NSNull and @""
  • From: Ian Joyner <email@hidden>
  • Date: Sat, 11 Oct 2008 15:13:00 +1100

On 11/10/2008, at 2:18 PM, Kyle Sluder wrote:

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.

Hmm, I have both the Smalltalk and Haskell books sitting on my desk for restudy. I think you have given me the impetus to study them together from this angle. Thanks.

Objective-C foregoes this formal type system so that things like KVO can function. It's a tradeoff, to be sure.

I'll have to think more about this. I'm not sure that KVO can't be done in a type-safe manner.

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.

Glad to hear that. I won't be abandoning Mac after 20 years anytime soon for that hopeless case Windows.


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.

I don't think the two are mutually exclusive. In a type-safe environment, type errors are caught (tested) by the compiler (so you don't need to develop tests for these cases). There are known situations where you don't want this, but to defer the exception to run time. A language can easily be defined to allow for this. It came up a while ago and I wrote an article on it:


http://web.me.com/ianjoyner/Ian_Joyner/Typing.html

I also wouldn't discount it happening in the future, after all Obj-C 2.0 gave us garbage collection.

Ian
_______________________________________________

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


  • Follow-Ups:
    • Re: NSNull and @""
      • From: Chris Idou <email@hidden>
References: 
 >NSNull and @"" (From: DKJ <email@hidden>)
 >Re: NSNull and @"" (From: Seth Willits <email@hidden>)
 >Re: NSNull and @"" (From: Ian Joyner <email@hidden>)
 >Re: NSNull and @"" (From: "Kyle Sluder" <email@hidden>)
 >Re: NSNull and @"" (From: Ian Joyner <email@hidden>)
 >Re: NSNull and @"" (From: "Kyle Sluder" <email@hidden>)

  • Prev by Date: Re: NSPersistentDocument No Support "Save To" ("Save As"?)
  • Next by Date: Re: Strategy for naming support folder
  • Previous by thread: Re: NSNull and @""
  • Next by thread: Re: NSNull and @""
  • Index(es):
    • Date
    • Thread