Skip to content
Open
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
7 changes: 6 additions & 1 deletion docs/_docs/reference/other-new-features/into.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ class without requiring a language import.
The first scheme is
to have a special type `into[T]` which serves as a marker that conversions into that type are allowed. These types are typically used in parameters of methods that are designed to work with implicit conversions of their arguments. This allows fine-grained control over where implicit conversions should be allowed. We call this scheme "_into as a type constructor_".

Following codes assumes this import to use `into` as a type constructor:

```
import scala.Conversion.into
```

The second scheme allows `into` as a soft modifier on traits, classes, and opaque type aliases. If a type definition is declared with this modifier, conversions to that type are allowed. The second scheme requires that one has control over the conversion target types so that an `into` can be added to their declaration. It is appropriate where there are a few designated types that are meant to be conversion targets. If that's the case, migration from Scala 2 to Scala 3
becomes easier since no function signatures need to be rewritten. We call this scheme "_into as a modifier_".


## Motivation

Scala 3's implicit conversions of the `scala.Conversion` class require a language import
Expand Down
Loading