3 ms·
What’s hideous about Swift closures (though I guess everything has always room for improvement) and how are F# and Kotlin better?
by Razengan 7y ago
What’s hideous about Swift closures (though I guess everything has always room for improvement) and how are F# and Kotlin better?
- rimliu 7y agoThis puzzled me too. Ok, blocks in Obj-C do look, err… interesting, but closures in Swift are totaly fine.
- saagarjha 7y agoMaybe the use of "in"?
- tigershark 7y ago(s1: String, s2: String) -> Bool in return s1 > s2 } In nested closures you can’t use the $0 syntax, swift type inference is pretty poor compared to F# and so a lot of time I have to explicitly specify the types and the in is much less clear than => or ->. To make it even more frustrating I have to specify the @escaping attribute in a lot of methods that accept closures as an argument.
- jbverschoor 7y agoyes, because of memory management. It's a good thing.