Re: [swift-users] Functions getting compiled multiple times

2017-11-05 Thread Slava Pestov via swift-users
> On Nov 5, 2017, at 12:23 PM, Dan Stenmark via swift-users > wrote: > > I’ve recently been profiling our compile times using the > -debug-time-function-bodies flag, and I’ve noticed that some functions seem > to be listed multiple times. I know that -debug-time-function-bodies isn’t > som

[swift-users] Functions getting compiled multiple times

2017-11-05 Thread Dan Stenmark via swift-users
I’ve recently been profiling our compile times using the -debug-time-function-bodies flag, and I’ve noticed that some functions seem to be listed multiple times. I know that -debug-time-function-bodies isn’t something that’s officially supported, but I’m not sure how to distinguish between a b

Re: [swift-users] How to store ref to any kind of function, and call with it argument list?

2017-11-05 Thread C. Keith Ray via swift-users
Thanks, that's working for me, though I have to specify the return type explicitly to avoid compile error. typealias TwoArgsFunction= (Any,Any)->Any func intToInt(_ i: Int, d: Double) -> Int { print("intToInt \(i) \(d)") return 4 } func typeEraseTwo(r: R.Type, fn: @escaping

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Charles Srstka via swift-users
> On Nov 5, 2017, at 10:39 AM, Dennis Weissmann > wrote: > >> You can delete the default case here, and your switch will still be >> exhaustive > That's exactly my problem! It is *not*. > > When I delete the default clause, the compiler warns that the switch is not > exhaustive and fixits sug

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Dennis Weissmann via swift-users
> You can delete the default case here, and your switch will still be exhaustive That's exactly my problem! It is *not*. When I delete the default clause, the compiler warns that the switch is not exhaustive and fixits suggest to add the "missing" deprecated cases. - Dennis > On Nov 5, 2017, at

[swift-users] TWISt-shout Newsletter 2017-11-06

2017-11-05 Thread Kenny Leung via swift-users
Hi All. Here is your TWISt-shout Newsletter for the week of 2017-10-30 to 2017-11-05 https://github.com/pepperdog/TWISt-shout/blob/master/2017/TWISt-shout-2017-11-06.md Enjoy! -Kenny _

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Charles Srstka via swift-users
> On Nov 5, 2017, at 9:27 AM, Dennis Weissmann > wrote: > > Hi Charles, > > I do believe you :) > > The problem is that this doesn't work without a compiler warning if you > switch over every case except for the deprecated ones because then the > compiler warns that "default will never be ex

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Dennis Weissmann via swift-users
Hi Charles, I do believe you :) The problem is that this doesn't work without a compiler warning if you switch over every case except for the deprecated ones because then the compiler warns that "default will never be executed". As per my first mail feel free to try this out in a playground:

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Charles Srstka via swift-users
> On Nov 5, 2017, at 3:14 AM, Dennis Weissmann > wrote: > > Hi Charles, > > You are right (the `default` case would not catch the deprecated values but > only new ones introduced in future releases), but the compiler doesn’t seem > to know that :( > > But now that you say it, one approach co

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread somu subscribe via swift-users
Also noticed that when Xcode prompts to fill the missing case statements, it fills it with the deprecated TouchID case statements (in an iOS 11 project). > On 5 Nov 2017, at 5:14 PM, Dennis Weissmann via swift-users > wrote: > > Hi Charles, > > You are right (the `default` case would not cat

Re: [swift-users] Handle deprecated enum cases from a library

2017-11-05 Thread Dennis Weissmann via swift-users
Hi Charles, You are right (the `default` case would not catch the deprecated values but only new ones introduced in future releases), but the compiler doesn’t seem to know that :( But now that you say it, one approach could be to pattern match the raw values (and, well, have a default clause,