Skip to content
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

Handling for IterableView -> View #235

Open
tfenne opened this issue Jul 20, 2019 · 2 comments
Open

Handling for IterableView -> View #235

tfenne opened this issue Jul 20, 2019 · 2 comments

Comments

@tfenne
Copy link

tfenne commented Jul 20, 2019

Apologies if this is already handled somehow and I'm missing how to use the compat library to work around it.

I'm struggling to find a way to cross-build between 2.12 an 2.13 when using IterableView in 2.12 and View in 2.13, since neither trait exists in the other version. What I've ended up doing is creating 2.12 and 2.13 specific source trees and defined the following:

// In 2.12
trait CrossCompatView[A, Coll] extends scala.collection.IterableView[A, Coll] {
  def underlying: Coll = this.asInstanceOf[Coll]
}

// In 2.13
trait CrossCompatView[A, Coll] extends scala.collection.View[A]

It would be nice if the collection-compat library could remove the need for this, either by introducing View[A] in the 2.12 tree or adding back a deprecated IterableView[A, Coll] in the 2.13 tree.

@julienrf
Copy link
Contributor

Would it work for you to add an alias like so on 2.12?

type View[+A] = IterableView[A, Seq] 

@tfenne
Copy link
Author

tfenne commented Jul 21, 2019

I think that would probably also work ... would just require classes mixing in the trait to still implement he underlying method from IterableView to satisfy things under 2.12. But yes, that would largely work.

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

No branches or pull requests

2 participants