Hi Scala Community!
I’d like to open the discussion for the pending SIP on dropping general type projection from the language. You can find a brief write up here.
Scala 2 currently allows general type projection of the form
T is an arbitrary type and
A names a type member of
Dotty prohibits this if
T is an abstract type (class types, singleton types and type aliases are still permitted). This change was made because unrestricted type projection is unsound.
The use of type projection from abstract types has been used to implement type functions in Scala 2 (see eg. this encoding of the SKI combinator calculus). This will no longer be possible.
In mitigation, this way of encoding type functions was always limited and extremely fragile due to compiler bugs and confusion around the semantics, and it has largely been displaced by implicit-driven type level computation. In Dotty we also have match types which allow type functions to be expressed directly.
Opening this up for general community discussion and insight into any other use cases that should be considered.