I am playing with Scala. What I need is just a brunch of function definitions, but in Eclipse I can only create .scala files for which a function def must be inside an object or class.
But I see a Scala script online, here, which does not use an object to wrap all the functions.
It is of course ok for me to use an object to wrap all my functions, but I am just wondering whether it is required. Thanks!
Note that in this case, the functions can’t be called from other files (they are wrapped in an
objectwith compiler-generated name when run). If you “need just a brunch of function definitions”, this is likely not what you want 🙂 AFAIK, Scala IDE doesn’t support script files at the moment, but you could log a feature request here.