Release Notes
This release raises the minimum supported Scala version from 3.3 to Scala 3.9, the new LTS. Projects using this release must compile with Scala 3.9 or later and run their builds on JDK 17 or later.
The upgrade adds support for Scala's experimental capture checking. When enabled in your build, the compiler rejects code that lets a capability escape the scope that provided it. Capture checking is optional. You can use PureLogic without enabling it.
For example, this batch export appears to record an audit entry for every order:
val (audit, csvRows) = Writer {
orders.iterator.map { order =>
write(s"exported ${order.id}")
order.toCsv
}
}Iterator.map is lazy, so Writer returns an empty audit before the mapping runs. Consuming csvRows later writes to a log whose result has already been returned. Capture checking rejects the code because the iterator would carry the Writer outside its scope. Materializing the rows inside the Writer block fixes the mistake.
See the new Capture checking guide for configuration and examples.
What's Changed
- Added capture-checking support in #6 by @ghostdogpr.
- Made
Writer.snapshotandWriter.rollbackpublic for custom recovery and rollback behavior in #63 by @ghostdogpr.