W开发者_Python百科hy is there no ARM (like Clojure's with-open
) provided in the Scala standard library?
Short answer
Because nobody's added one yet!
Longer answer
Many proposals for a bigger better I/O library have been put forward, but the best API to use has proved controversial. In particular, the exact way to handle newlines when reading a file line-by-line is a sensitive subject. (e.g. should they be stripped, or passed through as-is? If stripped, should empty lines be skipped over?)
This tends to encourage third-party libraries favouring different needs.
Having said all that... You may want to check out jsuereth's offering on github: https://github.com/jsuereth/scala-arm/wiki
精彩评论