This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Cannot run a Scala source as a script

No replies
E. Labun
Joined: 2010-06-20,
User offline. Last seen 42 years 45 weeks ago.

Hi All,

this file can be started with the Scala script runner ´scala test.scala´, but it doesn't print anything:

---------- test. scala -----------
object A
object Y {
def main(args: Array[String]) {
println("running")
}
}
----------------------------------

If I comment out the ´object A´ line, then all is OK, the string "running" is printed.

Why is it so? Is it possible to make the script working with additional definitions
(classes/objects/traits) in the file?

Thanks,
Eugen

see also:
https://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_9_1_final/src/...

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland