Yes, and b has the same type as a.
c has some opaque type, which we only know is "conforming to T", but whose underlying type is the same as a.
d can hold any type that conforms to T. At the point of its initialization, it dynamically holds something that is the type of a.
This isn't the same as your first one, because every utterance of some T is a unique opaque type.
A refactoring action that took a single utterance of some P and turned it into an explicit generic type parameter would affect only the signature of your function (not the body), and everything else would work the same:
func foo<SomeT: T>(a: SomeT) {
let b = a
let c: some T = a
let d: any T = a
}
}
Yes, absolutely! I'll clarify this in the proposal document, thanks.
[EDIT: this was already in the document, with this example:
func encodeAnyDictionaryOfPairs(_ dict: [some Hashable & Codable: Pair<some Codable, some Codable>]) -> Data
]
I really think that, if you're going to be introducing a new for the generic type parameter so that you can use it in multiple places, the generic parameter list is the right place for it.
No, this would be written some Any, just like we have the ability to write any Any with SE-0335.
This proposal is a necessary step to doing that, but there are a lot of other considerations as well. Can we keep that discussion separate?
Ah, I pushed the proposal before posting the thread here. I'll go update the links.
Doug