Skip to content

Disallow unapplied types in aliases and bounds #9090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 3, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 31, 2020

It's the same as scalac in this respect.

Early on in Dotty's development, we allowed aliases such as

type L = List

since we treated type parameters as type members, and higher-kinded
types as existential types. This is no longer the case. So the original
motivation for this is gone.

Furthermore, such higher-kinded aliases and bounds tend to make code
more obscure since the kind of a type is no longer obvious. They also
tend to exploit lots of dark corners in the compiler, where we do not
guard properly or early enough against kind-incorrectness. So the restricted
system is both safer and leads to clearer code.

Based on #9089

odersky added 5 commits June 1, 2020 11:07
It did not work for curried type lambdas.
It's the same as scalac in this respect.

Eearly on, we allowed aliases such as
```
type L = List
```
since we treated type parameters as type members, and higher-kinded
types as existential types. This is no longer the case. So the original
motivation for this is gone.

Furthermore, such higher-kinded aliases and bounds tend to make code
more obscure since the kind of a type is no longer obvious. They also
tend to exploit lots of dark corners in the compiler, where we do not
guard properly or early enough against kind-incorrectness. So the restricted
system is both safer and leads to clearer code.
@odersky odersky force-pushed the disallow-unapplied branch from af1c619 to 7224900 Compare June 1, 2020 09:12
@neko-kai
Copy link
Contributor

neko-kai commented Jun 1, 2020

@odersky May be we could go in the opposite direction and make this a feature? Kind Inference

@odersky
Copy link
Contributor Author

odersky commented Jun 1, 2020

@neko-kai Certainly not for 3.0. AFAIK this is still very much research terrain. So let's get that done first and if someone then has the energy to implement and prove sound a proposal let's judge it on its merits. I won't be the one doing this, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants