• 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: Swift generics, circular type declarations, and segfaults, oh my!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift generics, circular type declarations, and segfaults, oh my!


  • Subject: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 06 Sep 2015 15:50:53 -0500

> On Sep 6, 2015, at 3:19 PM, Quincey Morris <email@hidden> wrote:
>
> (But merely defining a protocol for each of your subclasses is not an improvement here.)

It does, however, seem to avoid the crash:

class ObjectBase<T> {
	required init() {}
}

protocol MyProtocol {
	func foo()
	func bar()
	func baz()
}

class MyObject: ObjectBase<MyProtocol>, MyProtocol {
	func foo() { print("foo") }
	func bar() { print("bar") }
	func baz() { print("baz") }

	required init() {}
}

let obj = MyObject()

compiles and runs without errors.

Charles

_______________________________________________

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: Swift generics, circular type declarations, and segfaults, oh my!
      • From: has <email@hidden>
    • Re: Swift generics, circular type declarations, and segfaults, oh my!
      • From: Jonathan Hull <email@hidden>
References: 
 >Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Fritz Anderson <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Charles Srstka <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: has <email@hidden>)
 >Re: Swift generics, circular type declarations, and segfaults, oh my! (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Next by Date: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Previous by thread: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Next by thread: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Index(es):
    • Date
    • Thread