elect
03/27/2019, 3:57 PMgildor
03/28/2019, 1:47 AMelect
03/28/2019, 8:12 AMgildor
03/28/2019, 8:16 AMgildor
03/28/2019, 8:16 AMelect
03/28/2019, 8:20 AMgildor
03/28/2019, 8:23 AMgildor
03/28/2019, 8:23 AMelect
03/28/2019, 8:23 AMelect
03/28/2019, 8:23 AMelect
03/28/2019, 8:23 AMgildor
03/28/2019, 8:24 AMgildor
03/28/2019, 8:24 AMelect
03/28/2019, 8:24 AMgildor
03/28/2019, 8:27 AMgildor
03/28/2019, 8:27 AMgildor
03/28/2019, 8:28 AMelect
03/28/2019, 8:29 AMgildor
03/28/2019, 8:32 AMgildor
03/28/2019, 8:32 AMgildor
03/28/2019, 8:41 AMtapchicoma
03/28/2019, 8:46 AMinfamous example of recursive type inference in SwiftJust curious - can you point me to some example of it?
gildor
03/28/2019, 8:48 AMgildor
03/28/2019, 8:48 AMgildor
03/28/2019, 8:49 AMgildor
03/28/2019, 8:49 AMgildor
03/28/2019, 8:50 AMtapchicoma
03/28/2019, 8:51 AMgildor
03/28/2019, 8:52 AMRight now, the canonical example of problematic code looks something like this:
Copy codelet sum = [1, 2, 3].map { String($0) }.flatMap { Int($0) }.reduce(0, +)
That converts an array of integers into an array of strings, then back to an array of integers, and adds them up.
It’s not the kind of code you’d write in anything serious, of course, but it does illustrate a problem: what might seem like fairly trivial work to us actually takes over 11 seconds to compile on a top of the range MacBook Pro.
gildor
03/28/2019, 8:57 AMgildor
03/28/2019, 8:59 AMrecursive type inference in SwiftProbably “recursive” is bad word, more precisly in those cases we see combinatorial explosion problem with type inference