xAlien95
(Stefano De Carolis)
50
This is a typo, right? It looks like a fusion between Swift and Kotlin 
Putting aside the _ placeholder, this is something already mentioned in the "medium priority list" of the Generics Manifesto. You can find it under the Parameterized extensions subsection:
Your syntax would be probably be spelled in the following way:
struct<Key: Comparable> Wrapper<T> where T == Dictionary<Key, _> { ... }
with Key being available exclusively in that declaration scope.
@Alejandro is tackling parameterized extensions (here are some insights with his current implementation), so if this proposal gets accepted and a proposal about parameterized extensions comes out, your suggestion would be more appropriate to be mentioned in the future directions section of that proposal, I think.
I think we should stick with _. In the future values could be used as generic parameters (Vector<Int, 3>, Vector<Int, 2>, etc.). It would be weird to force users to distinguish between types and values with * and _ respectively:
let e1: Vector<Int, 3> = (1, 0, 0)
let e2: Vector<*, 3> = (0, 1, 0)
let e3: Vector<*, _> = (0, 0, 1)
2 Likes