Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a Scala script file in Eclipse

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!

like image 946
Yin Zhu Avatar asked Oct 30 '11 11:10

Yin Zhu


1 Answers

But I see a Scala script online, here, which does not use an object to wrap all the functions.

Note that in this case, the functions can't be called from other files (they are wrapped in an object with 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.

like image 130
Alexey Romanov Avatar answered Sep 18 '22 11:09

Alexey Romanov