Avatar
omochimetaru 3/6/2019 10:20 AM
>The opaque type must be the entire return type of the function, For example, one cannot return an optional opaque result type: func f(flip: Bool) -> (some P)? { // error: `some P` is not the entire return type ... }
10:20 AM
The grammatical production for opaque result types is straightforward: type ::= opaque-type opaque-type ::= 'some' type The type following the 'some' keyword is semantically restricted to be a class or existential type, meaning it must consist only of Any, AnyObject, protocols, or base classes, possibly composed using &.
10:21 AM
() -> some (P?)() -> (some P)? も使えなくて困らないんだろうか?
10:21 AM
throwsとOptionalで格差が出ちゃうのも気持ち悪い
10:22 AM
Collection.firstとか使えないと思ったが、.first.first: Element? だから、ここは some のユースケースじゃないので大丈夫なんだけど・・・。