Re: [swift-users] Quick Question about ExpressibleByStringLiteral

2017-03-09 Thread David Sweeris via swift-users
Great! Thanks, Andrew :-) - Dave Sweeris > On Mar 9, 2017, at 6:00 PM, Jordan Rose wrote: > > Andrew Bennett is two steps ahead of you. :-) > https://github.com/apple/swift/pull/7125 > > > Jordan > >> On Mar 9, 2017, at 17:59, David Sweeris via swi

Re: [swift-users] Quick Question about ExpressibleByStringLiteral

2017-03-09 Thread Jordan Rose via swift-users
Andrew Bennett is two steps ahead of you. :-) https://github.com/apple/swift/pull/7125 Jordan > On Mar 9, 2017, at 17:59, David Sweeris via swift-users > wrote: > > If my type doesn’t know/care about the difference between a normal “String" > and a

[swift-users] Quick Question about ExpressibleByStringLiteral

2017-03-09 Thread David Sweeris via swift-users
If my type doesn’t know/care about the difference between a normal “String" and an “ExtendedClusterScalarGraphemeLiteralUnicodeTypeCluster” (or whatever those other literal types are called), is there anything wrong with doing this? public protocol EasilyExpressibleByStringLiteral : ExpressibleBy

Re: [swift-users] Protocol conformance failure

2017-03-09 Thread Guillaume Lessard via swift-users
> On Mar 9, 2017, at 12:46, Edward Connell via swift-users > wrote: > > // Everything compiles fine until this > someFunc(items: items) This is a frequent pain point: protocol existentials cannot stand in for the protocol they represent. Your function wants a concrete type that conforms to It

[swift-users] Protocol conformance failure

2017-03-09 Thread Edward Connell via swift-users
The error says ItemProtocol does not conform to ItemProtocol. That doesn't make sense. It seems this should work fine. // It's all clean until the last line protocol ItemProtocol : class { var message: String { get } } // heterogenious types class A : ItemProtocol { var message = "A" } class B :

Re: [swift-users] Unexpected results when using String.CharacterView.Index

2017-03-09 Thread Zhao Xin via swift-users
Thanks a lot, Ole. I understand now. Zhaoxin On Thu, Mar 9, 2017 at 7:54 PM, Ole Begemann wrote: > On 09/03/2017 08:27, Zhao Xin via swift-users wrote: > >> When using subscript of `String.CharacterView`, I got an unexpected error. >> >> fatal error: Can't form a Character from an empty Str

Re: [swift-users] Generics with variable argument lists

2017-03-09 Thread Rien via swift-users
Ah!, yes that would be perfect! Many thanks! Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Balancingrock Project: http://swiftfire.nl > On 09 Mar 2017, at 12:36, Ole Begemann wrote: > > On 09/03/2017 11:05, Rien via swift-users w

Re: [swift-users] Unexpected results when using String.CharacterView.Index

2017-03-09 Thread Ole Begemann via swift-users
On 09/03/2017 08:27, Zhao Xin via swift-users wrote: When using subscript of `String.CharacterView`, I got an unexpected error. fatal error: Can't form a Character from an empty String func test() { let s = "Original Script:" let cs = s.characters //let startIndex = cs.startInde

Re: [swift-users] Generics with variable argument lists

2017-03-09 Thread Ole Begemann via swift-users
On 09/03/2017 11:05, Rien via swift-users wrote: I am trying to achieve the following: enum FunctionResult { case success(T) case error(String) } func tester(test: (…) -> FunctionResult, onError: (String) -> T) -> T { … } The problem is of course the (…) that simply does not work. I wo

[swift-users] Generics with variable argument lists

2017-03-09 Thread Rien via swift-users
I am trying to achieve the following: enum FunctionResult { case success(T) case error(String) } func tester(test: (…) -> FunctionResult, onError: (String) -> T) -> T { … } The problem is of course the (…) that simply does not work. I would like to use this generic with a variety of diff