After sleeping on this I agree. Using some
would hurt searchability and describes the feature no better than opaque
does. If we go with opaquetype
then IMO the type should have to be given a name explicitly, so -> opaquetype Collection where _.Element == Int
would be disallowed.
There have been proposed syntaxes that would allow this sort of behavior, either via a typealias
or some other annotation of the return type, so that something like this would be legal:
typealias opaque Q: A where B: C = MyConcreteType
func d() -> Q {
return ...
}
func e() -> Q {
return d()
}
func f() -> e().ResultType {
e()
}
let f = [d(), e(), f()] // OK!
Does this address your concerns?
For the same reason I've soured somewhat on some
, I think this would be even worse. Single quotes don't suggest any meaning at all, and don't even really mirror any other syntax related to this feature. With Array
and Dictionary
shorthand, you can at least argue that the terse syntax mirrors the construction of a literal, and with Optional
the shorthand mirrors Optional
chaining. Furthermore, with the forward motion on character integer literals, we would be introducing two entirely unrelated uses of single quotes.