Useful resource for scala scripts

I would really like to find a resource for a good entry into the scala script. Something that correctly uses library dependencies, and examples for executing system processes and properly handling I / O.

I found snippets on the Internet, but nothing useful as a solid link for a beginner. Perhaps there is one chapter out of many scala books that I have not yet found.

Any help in tracking something like this would be much appreciated.

Regards, Adam

+4
source share
2 answers

Take a look at the standard scala.sys package

This package was added in Scala 2.9 and contains utilities ported from the compiler and sbt to help with system tasks and scripts. It contains access to system properties, environment variables, runtime, threads, and last, but not least, processes using Scala ProcessBuilder and other tools.

For scripting, you can also look at scalax Scala-io libraries, which can soon be distributed with Scala. These libraries support good abstractions for I / O, file systems, paths and files, and they also use automatic resource management, path sets, global usage, and other useful features.

+1
source

You can write any code you want in a script with the extension .scala. There is no difference in writing "normal" code. You can execute the code after saving, as usual.
Note that most IDEs do not support scripts.
Here is the link to the article describing the topic.

0
source

Source: https://habr.com/ru/post/1411083/


All Articles