Comments (5)
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
orscala.Predef
namespaces, which are (in general) automatically imported by Scala projects ; - implicit conversions enriching
Array
s and providingRange
syntax are inscala.Predef
too. I think that we will have to unimport the implicits that are inPredef
and to import those that are (currently) instrawman.collection
.
from collection-strawman.
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.
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.
Can you provide some example diffs @julienrf ? It should be possible to implement some of these with Scalafix.
from collection-strawman.
- When a “default” collection is used (e.g.
List
) we should unimport it from thescala
package and import it fromstrawman.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 tostrawman.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
andArray
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)
- TraversableOnce is missing
- Rename `to` to `as` HOT 10
- `seq` operation has been removed HOT 3
- Rewrite `--` operation to `&~` or `diff` HOT 1
- Rewrite `retain` to `filterInPlace`
- ArrayOps does not have a `view` operation anymore HOT 1
- Modularize the migration rewrite rules HOT 1
- Reorganize repositories
- Bring back Iterator.duplicate
- Set.apply / Map.apply don't use SetN / MapN
- We need dev-oriented documentation for M4 HOT 2
- ArrayOps doesn’t provide a sliding operation
- Make scala.Iterable[+A] = scala.collection.immutable.Iterable[A] HOT 8
- Setup collections-compat release infra
- add `()` to `toArray` HOT 1
- resolve status of `scala.collection.immutable.useBaseline` HOT 6
- IterableOnce.scala: def toSet[B >: A]: immutable.Set[B] should be def toSet: immutable.Set[A] HOT 2
- Main criticism HOT 3
- close or transfer all open issues and archive the repository HOT 1
- Delete and archive Gitter room HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from collection-strawman.