SIP-21 - Spores - Scala Documentation

By: Heather Miller, Martin Odersky, and Philipp Haller

Updated September 15th, 2013

This is a companion discussion topic for the original entry at

Will the capture syntax support expressions?

I expect the captured expression will be cached at the beginning of spore block.

For example, given:

val x: String = "Hello, World"
spore { () =>

Then it can be translated to

val x: String = "Hello, World"

val tmp0 = x.length;
{ () =>

The behavior of caching at beginning is important for lazy vals:

object NotSerializable {
  lazy val x: String = "Hello, World"
  def makeClosure = spore { () =>