Skip to content

Using(new Source(...)) for Scala 2.11 #582

@kwalcock

Description

@kwalcock

In Scala 2.11, Source is not Closeable so that Using(new Source(...)) results in

[error] ...: could not find implicit value for parameter releasable: scala.util.Using.Releasable[scala.io.BufferedSource]
[error]     Using.resource(Source.fromFile(...)) { source =>
[error]                                          ^
[error] one error found

This can be worked around with code like

  implicit object SourceReleaser extends Releasable[Source] {
    override def release(resource: Source): Unit = resource.close
  }

If I add that somewhere, I believe that an additional import will be needed in my code. If it gets added somewhere inside scala.util.Using, which seems to be part of this project, the extra import might not be necessary and that would be very nice to have.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions