Twitter | Search | |
Peter Steinberger Feb 10
Reply Retweet Like
Nicolai Henriksen Feb 11
Replying to @steipete
Disagree. Most new stuff makes Swift simpler, easier to use and cleans up past mistakes. IMHO. Not all! Agree. But most. I feel that Swift changes are 80 % in the right direction.
Reply Retweet Like
Peter Steinberger Feb 11
Replying to @nicolaih
callAsFunction
Reply Retweet Like
Joe Groff
Well, with `callAsFunction`, closures can just become regular structs instead of a weird special kind of thing
Reply Retweet Like More
Jérôme Alves Feb 11
Hence, would it be possible to be able to pass any type implementing `callAsFunction` anywhere a closure is expected? BTW, having this feature would fix a limitation of SE-249 “Key Path Expressions as Functions”.
Reply Retweet Like
Joe Groff Feb 12
There's a proposal out to make it so that protocols with a `callAsFunction` requirement can be used with closure literals to create ad-hoc structs: I think the eventual endpoint would be that function types themselves become generic constraints like Rust
Reply Retweet Like
Nicolai Henriksen Feb 11
Replying to @jckarter @steipete
As a Swift user I do not really see the benefit of “closures can just become regular structs”. I understand it can have benefits “below the surface” but as app programmer will this make a difference? I really miss that kind explanations for some of the newest Swift additions.
Reply Retweet Like