Skip to content

Commit 74c8f75

Browse files
committed
Submit a SIP on existential containers
1 parent 4241422 commit 74c8f75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

content/existential-containers.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ In broad strokes, our solution generalizes the following possible implementation
6969

7070
```scala
7171
trait AnyPolygon:
72-
type Value
72+
type Value: Polygon as witness
7373
val value: Value
74-
val witness: Polygon { type Self = Value }
7574

7675
def largest(xs: Seq[AnyPolygon]): Option[AnyPolygon] =
7776
xs.maxByOption((a) => a.witness.area(a.value))
@@ -153,6 +152,11 @@ More specifically, given an existential container `c`, accessing `c.value` _open
153152

154153
Since no change in implicit resolution is needed, this proposal cannot create unforeseen negative interactions with existing features.
155154

155+
### Other concerns
156+
157+
This document has been written under the experimental modularity improvements for Scala 3.
158+
Although the proposed feature is fully expressible without those changes, the encoding of existential containers can only work with the "old" (i.e., the one currently used in production) or "new" type class style.
159+
156160
### Open questions
157161

158162
One problem not addressed by the proposed encoding is the support of multiple type classes to form the interface of a specific container.

0 commit comments

Comments
 (0)