Go Home Swift Compiler, You’re Drunk
spin.atomicobject.com
Go Home Swift Compiler, You’re Drunk
1–10 of 29 posts
Re: Go Home Swift Compiler, You’re Drunk
#2https://www.reddit.com/r/programming/comments/4givdg/go_home...
"edit: for the code, it's just changing let myCompany to
let myCompany: [String: [String: [String: String]]]'
Re: Go Home Swift Compiler, You’re Drunk
#3I thought they fixed this, though. I filed it for Array> long ago, and they patched that case. https://twitter.com/kongtomorrow/status/565844856690339841
Re: Go Home Swift Compiler, You’re Drunk
#4Re: Go Home Swift Compiler, You’re Drunk
#5The problem, by the way, is that the use of nested literals (string and dictionary, here) causes the compiler to do a very large search to resolve the types. A quoted string, e.g. "foo", could be any type that conforms to StringLiteralConvertible. It's evaluating all permutations of potential type assignments to each literal that appears. I thought they fixed this, though. I filed it for Array > long ago, and they pa…
Re: Go Home Swift Compiler, You’re Drunk
#6The problem, by the way, is that the use of nested literals (string and dictionary, here) causes the compiler to do a very large search to resolve the types. A quoted string, e.g. "foo", could be any type that conforms to StringLiteralConvertible. It's evaluating all permutations of potential type assignments to each literal that appears. I thought they fixed this, though. I filed it for Array > long ago, and they pa…
Jeez. Is there some sort of hint to indicate that a string is just a string? Otherwise that seems like it will always be slow.
Yes, the type inference in this case could use some improvement -- maybe guess the simplest possible interpretation first, and search the space of alternatives in the background, assuming there's a mechanism to go back for a do-over if any are eventually found...?
Re: Go Home Swift Compiler, You’re Drunk
#7Wow, this is so sad, that compiler has to be extremely bad implemented
Re: Go Home Swift Compiler, You’re Drunk
#8Earlier quoted context omitted.
Jeez. Is there some sort of hint to indicate that a string is just a string? Otherwise that seems like it will always be slow.
Well, yes; it's called type annotation (as noted in comments both here and at the original article). Telling the compiler it's "just a String" (or more precisely a dictionary containing strings) cuts the compile time to 100ms. Yes, the type inference in this case could use some improvement -- maybe guess the simplest possible interpretation first, and search the space of alternatives in the background, assuming there…
Re: Go Home Swift Compiler, You’re Drunk
#9Now take XCode, that is some real drunk.