Skip to content

Fix #2591: Incorrect documentation on general type projections #2603

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 2 commits into from
May 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions docs/docs/reference/dropped/type-projection.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ title: Dropped: General Type Projection
Scala so far allowed general type projection `T#A` where `T` is an arbitrary type
and `A` names a type member of `T`.

Dotty allows this only if `T` is a class type. The change was made because
unrestricted type projection is [unsound](https://github.com/lampepfl/dotty/issues/1050).
Dotty disallows this if `T` is an abstract type (class types and type aliases
are fine). This change was made because unrestricted type projection
is [unsound](https://github.com/lampepfl/dotty/issues/1050).

The restriction rule out the [type-level encoding of compbinator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave the "restructions rule out" part in. Otherwise LGTM.

calculus](https://michid.wordpress.com/2010/01/29/scala-type-level-encoding-of-the-ski-calculus/). It also rules out the previous encodings of type
lambdas using structural types with projection as application. Type
lambdas are now [directly supported](../type-lambdas.md) in Dotty.
This restriction rules out the [type-level encoding of a combinator
calculus](https://michid.wordpress.com/2010/01/29/scala-type-level-encoding-of-the-ski-calculus/).

To rewrite code using type projections on abstract types, consider using
path-dependent types or implicit parameters.