Substrate

#swift-evolution #swift-ui
swift-evolution/0244-opaque-result-types.md
swift-evolution/0244-opaque-result-types.md
Right now, if you want to abstract the return type of a declaration from its signature, existentials or manual type erasure are your only options, and these come with tradeoffs that are not always acceptable. Instead of declaring the specific return type of `EightPointedStar.shape`'s current implementation, all we really want to say is that it returns something that conforms to `Shape`. We propose the syntax `some Protocol`. An opaque return type can be thought of as putting the generic signature “to the right” of the function arrow; instead of being a type chosen by the caller that the callee sees as abstracted, the return type is chosen by the callee, and comes back to the caller as abstracted. or some composition thereof (joined with `&`)
·github.com·
swift-evolution/0244-opaque-result-types.md