creativescala / doodle

Compositional vector graphics in Scala / Scala.JS
https://creativescala.org/doodle/
Apache License 2.0
329 stars 76 forks source link

Cannot use text algebra in scala 3.1.0 #111

Closed custommonkey closed 2 years ago

custommonkey commented 2 years ago

The definition of the text object in the doodle.syntax package object clashes with the definition of the text function in TextSyntax

Example:

    import doodle.java2d.algebra.Algebra
    import doodle.java2d.Drawing
    import doodle.syntax.*
    text[Algebra, Drawing]("scsdcs")

Compiler output:

Toplevel definition text is defined in
  /Users/jemartin/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/creativescala/doodle-core_3/0.10.0/doodle-core_3-0.10.0.jar(doodle/syntax/package.class)
and also in
  /Users/jemartin/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/creativescala/doodle-core_3/0.10.0/doodle-core_3-0.10.0.jar(doodle/syntax/TextSyntax.class)
One of these files should be removed from the classpath.
noelwelsh commented 2 years ago

Thanks for reporting this. Looks like a change from Scala 2 to Scala 3. I'll think about the best way to address this. For now you can write text.text("foo") and it should work.

On Thu, Dec 30, 2021 at 1:03 PM Jeff Martin @.***> wrote:

The definition of the text object in the doodle.syntax package object clashes with the definition of the text function in TextSyntax

Example:

import doodle.java2d.algebra.Algebra
import doodle.java2d.Drawing
import doodle.syntax.*
text[Algebra, Drawing]("scsdcs")

Compiler output:

Toplevel definition text is defined in /Users/jemartin/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/creativescala/doodle-core_3/0.10.0/doodle-core_3-0.10.0.jar(doodle/syntax/package.class) and also in /Users/jemartin/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/creativescala/doodle-core_3/0.10.0/doodle-core_3-0.10.0.jar(doodle/syntax/TextSyntax.class) One of these files should be removed from the classpath.

— Reply to this email directly, view it on GitHub https://github.com/creativescala/doodle/issues/111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH5XFPHH4F3ONRG4CQSLDUTRKAXANCNFSM5K7V5HJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

custommonkey commented 2 years ago

Unfortunately text.text("foo") doesn't work either. Current work around has been to fork the repo and delete the text object.

noelwelsh commented 2 years ago

I think I'll follow the design in Cats and Cats Effect and shift "import everything" out of the package object and into an object named all. This will break existing code.

import doodle.syntax._

will change to

import doodle.syntax.all._

0.10 hasn't been officially released yet so it's ok to include as part of the first offical 0.10 release.

noelwelsh commented 2 years ago
noelwelsh commented 2 years ago

Should all be good to go in the next release.