Skip to content

Conversation

@szeiger
Copy link
Contributor

@szeiger szeiger commented Aug 14, 2018

This was added in collection-strawman for cross-compiling with Dotty.
Nowadays Dotty doesn’t have AnyConstr anymore so there’s no point in
moving it to scala.AnyConstr for compatibility.

This was added in collection-strawman for cross-compiling with Dotty.
Nowadays Dotty doesn’t have `AnyConstr` anymore so there’s no point in
moving it to `scala.AnyConstr` for compatibility.
@szeiger szeiger added this to the 2.13.0-M5 milestone Aug 14, 2018

/** An `IndexedSeqOps` whose collection type and collection type constructor are unknown */
type SomeIndexedSeqOps[A] = IndexedSeqOps[A, AnyConstr, _]
type SomeIndexedSeqOps[A] = IndexedSeqOps[A, Any, _]
Copy link
Member

Choose a reason for hiding this comment

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

That won't compile with Dotty because Any is not poly-kinded there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, yes, we'll need to change the sources for Dotty. We have to do that anyway, because the definition of AnyConstr wouldn't compile, either. What's the current replacement anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was actually thinking of the original definition type AnyConstr = Any but now we have type AnyConstr[X] = Any which would cross-compile.

But we still shouldn't have scala.collection.AnyConstr. This is an implementation detail that is not supposed to leak into user code and it is not specific to collections. If we want to keep this abstraction it either needs to be properly supported (e.g. adding scala.AnyConstr in 2.13 and Dotty) or hidden away (is it possible?)

Copy link
Member

Choose a reason for hiding this comment

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

Just write a type lambda, since Scala 2 doesn't have nice syntax for them you need to use the projection trick ({ type L[A] = Any })#L

Copy link
Member

Choose a reason for hiding this comment

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

Using a private type alias would probably work too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks promising. I've opened #7077 to make it private. We can still consider better solutions for RC1.

@szeiger szeiger modified the milestones: 2.13.0-M5, 2.13.0-RC1 Aug 15, 2018
@szeiger szeiger added the WIP label Aug 15, 2018
@SethTisue
Copy link
Member

@szeiger #7077 is merged and M5 shipped. should this one stay open for RC1...?

@szeiger
Copy link
Contributor Author

szeiger commented Nov 7, 2018

The status quo is probably the best we can do. Adding scala.AnyConstr would make sense for Scala but with the type lambda syntax in Dotty there's no need for it, so let's just keep the private AnyConstr as an implementation detail for now.

@szeiger szeiger closed this Nov 7, 2018
szeiger added a commit to szeiger/scala that referenced this pull request Dec 7, 2018
This also provides a nice solution for AnyConstr (see
scala#7077 and
scala#7072): We simply don’t need it
anymore.
szeiger added a commit to szeiger/scala that referenced this pull request Dec 11, 2018
This also provides a nice solution for AnyConstr (see
scala#7077 and
scala#7072): We simply don’t need it
anymore.

We really want to constrain both IterableCC and MapCC to Iterable
(the latter because it’s needed for MapView) but that causes collisions
after erasure, so we have to go back to IterableOnce for IterableCC.
Using something more specific (like MapOps with Iterable) for
MapCC is not possible because in MapView the MapCC is not actually
MapView but only View.
@SethTisue SethTisue removed this from the 2.13.0-RC1 milestone Feb 22, 2019
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