Giter Site home page Giter Site logo

Comments (5)

julienrf avatar julienrf commented on June 15, 2024 1

I’m sorry the issue description lacks details. Let me add some details: to move a code base to the strawman, a rule of thumb is just to import collection types from the strawman.collection namespace instead of scala.collection. However, there are some corner cases:

  • some aliases are in the scala or scala.Predef namespaces, which are (in general) automatically imported by Scala projects ;
  • implicit conversions enriching Arrays and providing Range syntax are in scala.Predef too. I think that we will have to unimport the implicits that are in Predef and to import those that are (currently) in strawman.collection.

from collection-strawman.

julienrf avatar julienrf commented on June 15, 2024

Corner case: 1 to 10 should produce a strawman.collection.immutable.Range. (We will have a similar problem with Array and String operations)

from collection-strawman.

ShaneDelmore avatar ShaneDelmore commented on June 15, 2024

What exactly is the issue? I think scalafix can handle this fairly easily but am not sure I am understanding what the problem is.

from collection-strawman.

olafurpg avatar olafurpg commented on June 15, 2024

Can you provide some example diffs @julienrf ? It should be possible to implement some of these with Scalafix.

from collection-strawman.

julienrf avatar julienrf commented on June 15, 2024
  • When a “default” collection is used (e.g. List) we should unimport it from the scala package and import it from strawman.collection:
+ import scala.{List => _}
+ import strawman.collection.immutable.List
List(1, 2, 3)
+ import scala.{Nil => _}
+ import strawman.collection.immutable.Nil
1 :: 2 :: 3 :: Nil
  • When a collection whose type is not aliased in the scala package is used, we should replace its import with one that points to strawman.collection:
- import scala.collection.mutable.ArrayBuffer
+ import strawman.collection.mutable.ArrayBuffer
  • When the Range syntax is used we should replace it with the one from the strawman:
+ import scala.Predef.{intWrapper => _}
+ import strawman.collection.intWrapper
1 to 10

(maybe it is enough to just import the new implicit conversion. I don’t know if there will be an ambiguity if don’t unimport the one in Predef)

  • When collection operations are used with String and Array values, we should replace the decorators with the one from the strawman:
+ import scala.Predef.{augmentString => _}
+ import strawman.collection.stringToStringOps
"foo" ++ "bar"
+ import scala.Predef.{intArrayOps => _}
+ import strawman.collection.arrayToArrayOps
Array(1, 2, 3) map (_ + 1)

from collection-strawman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.