Re: a more robust (file) io capability in scala core library?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: a more robust (file) io capability in scala core library?

Ben Hutchison-3
+1. Pretty much sums it up for me too.

On Wed, Sep 18, 2013 at 6:18 AM, Haoyi Li <[hidden email]> wrote:
+1 for a nice file IO library. I think this is one of the things where the "lets take our time and do it properly" has been going on for far too long: years now. I'm pretty sure there's no shortage of demand for any reasonable implementation, given the compiler has its own mini-IO library, akka/spray have their own, and basically everyone writes the same few utility methods before they start doing anything with files. Even without fancy things like nio, non-blocking-ness, continuations, iteratees/enumeratees, it would be a huge convenience.


On Tue, Sep 17, 2013 at 10:48 AM, Rex Kerr <[hidden email]> wrote:
It's not hard to write an extension method that does what you need:

implicit class Tidying[A](val a: A) extends AnyVal {
  def tidily[Z](g: A=>Any)(f: A=>Z) = try { f(a) } finally { g(a) }
}

Then you
  io.Source.fromFile("blah.txt").tidily(_.close)(_.getLines.toVector)
or whatever.

Scala is pretty light on handy utility methods for now.  I wouldn't expect that to change in the near term.

  --Rex



On Tue, Sep 17, 2013 at 10:30 AM, Ido Tamir <[hidden email]> wrote:
If its make a wish time, I would rather like to see an ARM implementation thats at least equal to javas try-with-resources in the standard-library.
Its more basic, general and probably less code (loan is about 15 lines, maybe one would like to add more sugar or rubustness) than an io-library.
The io-library would have to use an some ARM I guess, so why not start with ARM?

best,
ido


On Monday, September 16, 2013 9:49:30 PM UTC+2, Simon Ochsenreither wrote:
Agree! Would make sense to look further into it as soon as Scala's baseline is >= Java 7 (no working filesystem API before that).

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "scala-debate" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.