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

naming clash #679

Open
robmwalsh opened this issue Mar 8, 2023 · 0 comments
Open

naming clash #679

robmwalsh opened this issue Mar 8, 2023 · 0 comments

Comments

@robmwalsh
Copy link

More of an annoyance than anything else.

zio has a LogAnnotation class as well, in the zio package which is generally imported with a wildcard.

import zio.*
import zio.logging.*

val customLogAnnotation = LogAnnotation[Int]("custom_annotation", _ + _, _.toString)

results in

[error] 43 |    LogAnnotation[Int](
[error]    |    ^^^^^^^^^^^^^
[error]    |    Reference to LogAnnotation is ambiguous,
[error]    |    it is both imported by import zio._
[error]    |    and imported subsequently by import zio.logging._

https://scastie.scala-lang.org/I2ab3bjGQZ64KZi1YJnfmA

perhaps the next major release could consider renaming LogAnnotation to avoid this

As we move to scala 3, the use of export statements is probably going to lead to users to generally expecting one import statement per library. clashes are inevitable, but for a library specifically designed to work with zio, and with a relatively small surface area, I think it's reasonable to avoid this.

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

1 participant