GithubHelp home page GithubHelp logo

scala-collection-compat_2.12-0.1.0.jar does not contains scala.collection.BuildFrom due to osgi setting about scala-collection-compat HOT 10 CLOSED

scala avatar scala commented on June 8, 2024
scala-collection-compat_2.12-0.1.0.jar does not contains scala.collection.BuildFrom due to osgi setting

from scala-collection-compat.

Comments (10)

lrytz avatar lrytz commented on June 8, 2024 1

Thinking how to go forward on this issue, I think it would be best to get rid of the split packages. Instead, the scala-collection-compat library should only expose types in the scala.collection.compat package.

This means we'd put the Factory and BuildFrom and ArraySeq (maybe collection.compat.immutable.ArraySeq?) classes into the compat package. In the 2.13 version, they would be type aliases.

Code that cross-compiles would use collection.compat.Factory. Once the library moves to 2.13 only, the code can change to collection.Factory.

from scala-collection-compat.

lrytz avatar lrytz commented on June 8, 2024

Oh, it threw out everything that's not in the compat package... Too bad I didn't notice when looking at the jar.

from scala-collection-compat.

julienrf avatar julienrf commented on June 8, 2024

What is the purpose of this osgi setting?

from scala-collection-compat.

lrytz avatar lrytz commented on June 8, 2024

To use our jars with osgi they need to define metadata. Split packages are problematic, search on google. I personally have no experience with osgi, few people around me do. But the metadata is improtant for those that want to use it. Our working mode is to continue emitting the metadata, rely on the community to report and fix issues.

In any case, split packages will also cause problems with the java module system.

from scala-collection-compat.

julienrf avatar julienrf commented on June 8, 2024

Ok, I think your solution would work well.

from scala-collection-compat.

lrytz avatar lrytz commented on June 8, 2024

Note: the idea of putting ArraySeq into the collection.compat.immutable package is not a good one. Having two immutable packages has too much potential to cause conflicts and confusion.

from scala-collection-compat.

julienrf avatar julienrf commented on June 8, 2024

The only problematic case I can think of is :

import collection.immutable
import collection.compat._

immutable.Something

Because in the last line immutable confusingly refers to the one in the compat object.

We can document this wart. I don't expect people to often import collection.immutable (in contrast with collection.mutable).

from scala-collection-compat.

szeiger avatar szeiger commented on June 8, 2024

I don't know how much of a problem this really is for OSGi. The library is coupled tightly to the standard library anyway so a split package might be just fine. AFAIK Java 9 modules don't support split packages though, so we may have to change it for that reason alone (i.e. if we want to support modules).

from scala-collection-compat.

lrytz avatar lrytz commented on June 8, 2024

I'm really not sure we should reuse immutable. I think we cannot just assume that noone imports collection.immutable.

scala> :pa -raw
// Entering paste mode (ctrl-D to finish)

package a { package imm { class C } }
package b { package imm { class D } }

// Exiting paste mode, now interpreting.


scala> import a._, b._
import a._
import b._

scala> new imm.C
res4: a.imm.C = a.imm.C@7761e342

scala> new imm.D
               ^
       error: type D is not a member of package a.imm

from scala-collection-compat.

som-snytt avatar som-snytt commented on June 8, 2024

@lrytz Not sure what's on your previous lines. Normally, it's ambiguous, but REPL nests the imports. You don't need -raw for packages.

scala 2.12.6> :pa
// Entering paste mode (ctrl-D to finish)

package a { package imm { class C } }
package b { package imm { class D } }

// Exiting paste mode, now interpreting.


scala 2.12.6> import a._, b._
import a._
import b._

scala 2.12.6> new imm.C
<console>:18: error: type C is not a member of package b.imm
              new imm.C
                      ^

from scala-collection-compat.

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.