• 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: Language options: Objective-C, Swift, C or C++?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Language options: Objective-C, Swift, C or C++?


  • Subject: Re: Language options: Objective-C, Swift, C or C++?
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 16 Jun 2015 07:58:55 +0000

On Jun 16, 2015, at 00:34 , Roland King <email@hidden> wrote:
>
> I think Protocol Extensions are the power feature to Swift this year

Yes, though I’ve been trying to convert a fair-sized app, and I ran into a conceptual difficulty when a protocol has a Self constraint.

In essence, a Self constraint prevents a protocol from being used like a base class. This shows up quickly when (say) you try to construct a Set<MyProtocol> which is going to contain various types that are unified only by MyProtocol. The underlying Set class has to Hashable, which means its also Equatable, which has a Self requirement to ensure that two objects being compared by == are of the same type.

You’d see this problem with the example in that video if you tried to make the SegueIdentifier protocol Hashable or Equatable.

Other really good features: value-type programming, and the ‘guard’ statement, which is much better in use than you’d expect.

The other major problem I ran into — unrelated, but I’m mentioning it in case someone wants to jump in and tell me the easy way — is that I’m trying to use frameworks in order to break the project into modules so that I can use the access controls (private and internal) to keep implementation details of related groups of files out of the grasp of unrelated code. This is in a cross-platform (OS X, iOS) project with shared code. Since the different platforms need different frameworks, and the frameworks/modules have to have different names to tell them apart, I can’t share source code files across platforms because of the “import” statements. Maybe I’m missing something obvious here.

> And now I know what Kyle looks like too!

What’s the video?



_______________________________________________

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: Language options: Objective-C, Swift, C or C++?
      • From: Roland King <email@hidden>
    • Re: Language options: Objective-C, Swift, C or C++?
      • From: Kevin Meaney <email@hidden>
References: 
 >Re: Language options: Objective-C, Swift, C or C++? (From: Roland King <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Quincey Morris <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Graham Cox <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Michael David Crawford <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Carl Hoefs <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: "Gary L. Wade" <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Quincey Morris <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Carl Hoefs <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Rick Mann <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Quincey Morris <email@hidden>)
 >Re: Language options: Objective-C, Swift, C or C++? (From: Roland King <email@hidden>)

  • Prev by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Next by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Previous by thread: Re: Language options: Objective-C, Swift, C or C++?
  • Next by thread: Re: Language options: Objective-C, Swift, C or C++?
  • Index(es):
    • Date
    • Thread