News for hackers. Stuff that matters.
Re:Lightweight API Design in Swift by Razengan on Tuesday November 26, 2019 @06:21AM (#21637320)
What’s hideous about Swift closures (though I guess everything has always room for improvement) and how are F# and Kotlin better?
Re:Lightweight API Design in Swift by tigershark on Tuesday November 26, 2019 @11:40AM (#21639897)
(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.
Re:Lightweight API Design in Swift by jbverschoor on Thursday November 28, 2019 @01:23PM (#21659265)
yes, because of memory management. It's a good thing.
Re:Lightweight API Design in Swift by rimliu on Tuesday November 26, 2019 @07:13AM (#21637588)
This puzzled me too. Ok, blocks in Obj-C do look, err… interesting, but closures in Swift are totaly fine.
Re:Lightweight API Design in Swift by saagarjha on Tuesday November 26, 2019 @09:45AM (#21638637)
Maybe the use of "in"?