Re: Instantiate NSString from NSURL in Swift
Re: Instantiate NSString from NSURL in Swift
- Subject: Re: Instantiate NSString from NSURL in Swift
- From: Quincey Morris <email@hidden>
- Date: Mon, 23 Feb 2015 19:25:37 +0000
On Feb 23, 2015, at 11:06 , Marco S Hyman <email@hidden> wrote:
>
> let foo = theUrl?.host?.lowercaseString
> let bar = NSString(string: foo!)
> let baz = NSString(string: theUrl?.host?.lowercaseString!)
>
> You'd think baz would be the same as bar.
I’m not so sure. a?.b! is (at least informally) ambiguous, for a?.(b!) or (a?.b)!
If the compiler interprets it as the first alternative, then I think you’d get what the OP observed, assuming ‘lowercase’ doesn’t return an optional result.
_______________________________________________
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