Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-18 Thread Glen Huang via swift-users
Do you think if there will be any evolution proposal to address this limitation? Or it’s an inherent tradeoff that is unlikely to be changed? > On 19 Jul 2017, at 8:49 AM, Jordan Rose wrote: > > > >> On Jul 18, 2017, at 10:33, Vladimir.S via swift-users

[swift-users] matching a protocol value in multiple patterns is not yet supported; use separate cases instead

2017-07-18 Thread Zhao Xin via swift-users
I encounter this error today. "matching a protocol value in multiple patterns is not yet supported; use separate cases instead" Sample code: import Foundation protocol NameProtocol { var name:String { get } } struct Cat:NameProtocol { let name:String } struct Dog:NameProtocol {

Re: [swift-users] Convenience initializers in structs?

2017-07-18 Thread Chris McIntyre via swift-users
Was it ever explained why the syntax is different? -- Chris McIntyre > On Jul 18, 2017, at 6:46 PM, Jens Persson via swift-users > wrote: > > That is not true. Structs can have delegating initializers but they cannot be > marked with `convenience` (only the

Re: [swift-users] Convenience initializers in structs?

2017-07-18 Thread Slava Pestov via swift-users
Hi Jens, While I’m not familiar with the integer API in the standard library, structs and enums certainly can have convenience initializers. They must delegate to another initializer (either convenience or designated) rather than initializing the fields of the type one by one. Slava > On Jul

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-18 Thread Jon Shier via swift-users
I'd agree with that. Fortunately there are tools out there that can parse such things and generate the constants for us already. Waiting for Xcode to implement such common sense quality of life improvements probably won't end. I'll file bugs in the meantime though. Jon > On Jul 18, 2017, at

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-18 Thread Hooman Mehr via swift-users
I think this should be a feature of Xcode to automatically generate / maintain these constants: When you add assets or create interface builder files, a plug-in could take care of generating / updating such constants and you would get auto-complete and type safety for free. > On Jul 18, 2017,

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-18 Thread Vladimir.S via swift-users
On 17.07.2017 4:51, Glen Huang via swift-users wrote: Thanks for the code sample and link, but if I’m not wrong, this pattern doesn’t allow heterogeneous items. Support the question. Trying to understand if we can have something like [AnyHashable] for our custom protocol(with associated type)

[swift-users] Convenience initializers in structs?

2017-07-18 Thread Jens Persson via swift-users
Start a command line project in Xcode 9 beta 3 and copy paste this single line of code into main.swift let _ = UInt8.init(extendingOrTruncating: UInt64(123456)) Now look at Quick Help while placing the cursor on `init` and then on `extendingOrTruncating`. Note that (and how) the documentation

Re: [swift-users] What is up with names not being Strings any more in Swift 4?

2017-07-18 Thread Manfred Schubert via swift-users
> Am 18.07.2017 um 00:58 schrieb Greg Parker via swift-users > : > > >> On Jul 17, 2017, at 10:01 AM, Nevin Brackett-Rozinsky via swift-users >> wrote: >> >> Could / should these types be ExpressibleByStringLiteral? > > They should not. We are