You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this way, it will show me details about warning.
$ ./test.scala
./test.scala:7: warning: implicit conversion method strToSymbol should be enabled
by making the implicit value scala.language.implicitConversions visible.
This can be achieved by adding the import clause 'import scala.language.implicitConversions'
or by setting the compiler option -language:implicitConversions.
See the Scaladoc for value scala.language.implicitConversions for a discussion
why the feature should be explicitly enabled.
implicit def strToSymbol(str: String): Symbol = Symbol(str)
^
hello, world
In my humble opinion, I have two suggestions:
Remove HelloWorld.main(args) from the example since it will cause a warning.
Using second header of script header since it can pass command line arguements of Scala.
The text was updated successfully, but these errors were encountered:
In the doc website: https://www.scala-lang.org/documentation/your-first-lines-of-scala.html
It shows a example of Scala script.
When I try to run it, the compiler returns a warning.
$ ./script.sh ./script.sh:6: warning: Script has a main object but statement is disallowed HelloWorld.main(args) ^ Hello, world!
In fact without
HelloWorld.main(args)
, it can also run while has access toargs
$ ./script.sh Hello, Scala Script Hello, world! Hello,ScalaScript
On the other hand, I found another Scala shell script example
In this one I can pass Scala comand line arguement such as
-feature
In this way, it will show me details about warning.
In my humble opinion, I have two suggestions:
HelloWorld.main(args)
from the example since it will cause a warning.The text was updated successfully, but these errors were encountered: