• 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: More Swift issues, NSURLComponents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More Swift issues, NSURLComponents


  • Subject: Re: More Swift issues, NSURLComponents
  • From: Rick Mann <email@hidden>
  • Date: Mon, 05 Oct 2015 19:57:04 -0700

No, no, I get all that. But in practice, these things look and smell the same. Looking at he calling code, you can't tell what's going on. So it has the feel of inconsistency. Especially when a struct can be an AnyObject.

Sent from my iPhone

> On Oct 5, 2015, at 19:19, Jens Alfke <email@hidden> wrote:
>
>
>> On Oct 5, 2015, at 6:59 PM, Rick Mann <email@hidden> wrote:
>>
>> Huh. I continue to be bothered by the ambiguity/variability of "let"*. Is the reference immutable or the thing it points to?
>
> A variable (var or let) doesn’t “point to” a struct. It _contains_ the struct. I.e. it’s a value, not a reference.
>
> It’s just like in C or C++, really. Given a struct Foo,
> 	const Foo x;  // a value: x is immutable; you can’t change its fields
> 	Foo* const x; // a reference: the variable x can’t be changed, but the Foo it points to can
>
> The thing Swift doesn’t have that C/C++ do is
> 	const Foo *x; // the Foo can’t be changed through this reference (though the value of x can)
> The reason this was left out is probably that it doesn’t fit at all with Objective-C and the Cocoa frameworks, which have no concept of a constant reference to an NSObject.
>
> —Jens
_______________________________________________

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: More Swift issues, NSURLComponents
      • From: Greg Parker <email@hidden>
References: 
 >More Swift issues, NSURLComponents (From: Rick Mann <email@hidden>)
 >Re: More Swift issues, NSURLComponents (From: Jens Alfke <email@hidden>)
 >Re: More Swift issues, NSURLComponents (From: Rick Mann <email@hidden>)
 >Re: More Swift issues, NSURLComponents (From: Charles Srstka <email@hidden>)
 >Re: More Swift issues, NSURLComponents (From: Rick Mann <email@hidden>)
 >Re: More Swift issues, NSURLComponents (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: More Swift issues, NSURLComponents
  • Next by Date: UIView rotate and cross-fade at the same time
  • Previous by thread: Re: More Swift issues, NSURLComponents
  • Next by thread: Re: More Swift issues, NSURLComponents
  • Index(es):
    • Date
    • Thread