Placeholder types

The Rorschach language™ strikes again!

Thanks for pointing that out, that is indeed the same kind of constraint. Considering that it's framed as being just for extensions I'm not sure I we can say it's mentioned there, but it's definitely related.

IMO that syntax runs against the spirit of changes we made long ago, moving parts of a generic declaration that don't describe structure to the back. For example, IIRC, it used to be possible to write

struct X<A, B: P where B.C == A, D>

and where clauses on generic functions used to appear before the return type.

In the example you gave, Key is not a part of the structure of the type being declared, and putting it at the head of the declaration gives it too much weight.

Good point that these things should be tied together. IMO it would be a mistake to tackle these things as though they were separate features unless there was some real implementation difficulty, though. We have enough contextual inconsistencies already regarding what can be expressed in the generics system.

1 Like