TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

First steps with Scala, say goodbye to bash scripts…

23 点作者 opensas超过 13 年前
Playframework 2.0 is right around the corner, and it’s core is programmed in Scala, so it’s a wonderful opportunity to give this object-oriented / functional hybrid beast a try… Like many others, I will pick a very simple script to give my first steps…

6 条评论

moonboots超过 13 年前
I still prefer a simple shell script for these use cases. Here's a snippet for the translated file size calculation:<p><pre><code> translated_files=$(grep "todavida no ha sido traducida" *) total_size=$(du --summarize . | cut -f 1) translated_file_size=$(du --summarize --total $(echo translated_files) | tail -n 1 | cut -f 1) echo "translated size: ${translated_file_size}KB/${total_size}KB $(($translated_file_size/$total_size))%"</code></pre>
评论 #3455983 未加载
评论 #3455587 未加载
评论 #3459585 未加载
评论 #3459589 未加载
jcdavis超过 13 年前
A nice article, but its worth mentioning that scala for bash script usage is a non-starter for most stuff you might use bash for because JVM startup overhead, even for the client VM, is so substantial
评论 #3455635 未加载
评论 #3455584 未加载
评论 #3459596 未加载
ww520超过 13 年前
I don't get how the bash scripts are not used. It's still used at<p><pre><code> #!/bin/sh exec scala "$0" "$@"</code></pre>
评论 #3455403 未加载
评论 #3455598 未加载
opensas超过 13 年前
Thanks to everybody's feedback on this one... You encouraged me to write another article, mainly because I felt a little guilty for bashing (pun intented) bash and python ;-) Hope you like it <a href="http://playlatam.wordpress.com/2012/01/13/first-steps-with-scala-revisited-bash-and-python-strikes-back/" rel="nofollow">http://playlatam.wordpress.com/2012/01/13/first-steps-with-s...</a>
jezclaremurugan超过 13 年前
nice article, but they could have removed the last part of the title. Its a nice way to learn scala, but a poor way to say goodbye to bash.
评论 #3459155 未加载
ronreiter超过 13 年前
What's wrong with Python?
评论 #3459617 未加载