Re: Stupid ! and ?
Re: Stupid ! and ?
- Subject: Re: Stupid ! and ?
- From: email@hidden
- Date: Sun, 26 Apr 2015 01:26:14 +0900
Sent from my iPhone
> On 2015/04/25, at 23:59, William Squires <email@hidden> wrote:
>
> Okay, I still don't get why Swift has this stupid ! and ? syntax. Why not just:
>
> 1) Explicitly state that object references must be tested for nil before use (like C,C++, etc...), or
This is what that means.
> 2) Use the ObjC behavior
It's a different language. One that aims for building a safe world. But it also lets you be unsafe but you have to "know what you're doing" or at least say so to Swift.
This tension is simply part of life when using objects that inherit from NSObject and when interfacing with C libraries where paradigms are different.
Swift 1.2 begins to address this with corresponding additions to Objective-C in the form of Nullability decorations. Make sure you update Xcode for the latest.
Also be wary of code on the web and in books as it can be outdated quickly with any new language.
Scripting languages are worse in this regard. Where frameworks change faster than documentation.
_______________________________________________
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