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

scala 3 vs scala 2 #65

Closed
xhudik opened this issue Feb 19, 2021 · 4 comments
Closed

scala 3 vs scala 2 #65

xhudik opened this issue Feb 19, 2021 · 4 comments

Comments

@xhudik
Copy link
Contributor

xhudik commented Feb 19, 2021

Hi, a newbie question:
if I add println(Console.YELLOW + s"Scala version = ${util.Properties.versionString}") into Main.scala and run sbt run I got:

Scala version = 2.13.4
Trait Params example:
Hello Dotty!

...

Any idea why I'm getting 2.13.4 instead of Scala 3.0.0RC1? (the true is that I have installed Scala 2.13.4 on my local laptop)

@bishabosha
Copy link
Member

bishabosha commented Feb 19, 2021

Yes, this is because Scala 3.0.0-RC1 reuses the standard library from 2.13.4, where scala.util.Properties is defined. The version string is stored in a file shipped in the org.scala-lang:scala-library:2.13.4 JAR.

@xhudik
Copy link
Contributor Author

xhudik commented Feb 19, 2021

Thanks @bishabosha ;
will final Scala 3 uses its own standard library? Other question - is there any way to find out what scala version is running the app?

@bishabosha
Copy link
Member

bishabosha commented Feb 19, 2021

is there any way to find out what scala version is running the app?

if your application includes the scala3-compiler_3.0.0-RC1 library in the classpath then you can use dotty.tools.dotc.config.Properties.versionString to get the Scala 3 version, or dotty.tools.dotc.config.Properties.versionMsg to include copyright message and optional git hash if it is a nightly. This is the property that is accessed when using -version flag with the compiler

@xhudik
Copy link
Contributor Author

xhudik commented Feb 19, 2021

indeed, this is working - thank you @bishabosha !! I'm closing the issue

@xhudik xhudik closed this as completed Feb 19, 2021
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

2 participants