Skip to content

glowskir/spores

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spores

Scala Spores, safe mobile closures

Updates since the first draft (June 16th, 2013) of SIP-21

Many users expressed concern that spores would be both unusable with for- expression syntax, and would be incompatible (without a lot of boilerplate) with normal closures or higher-order functions which take normal functions as arguments.

Capture Syntax

To remedy the incompatibility with for-expressions, we propose a new capture syntax.

Stable Paths

A stable path is an expression which only contains selections and identifiers (no applications, for example), and for which each selected entity is stable. In this context, stable means that the entity or object in question is introduced by object definitions or by value definitions of non-volatile types.

Adapted from the Scala Language specification (section 3.1), a path is defined to be one of the following:

  • C.this, where C references a class. The path this is taken as a shorthand for C.this where C is the name of the class directly enclosing the reference.
  • x where x is a package.
  • p.x where p is a path and x is a stable member of p. Stable members are packages or members introduced by object definitions or by value definitions of non-volatile types. (Section 3.6 of the SLS.)
  • C.super.x or C.super[M].x where C references a class and x references a stable member of the super class or designated parent class M of C. The prefix super is taken as a shorthand for C.super where C is the name of the class directly enclosing the reference.

A path refers to an object, that is, it ends with an identifier.

Uglies

  • Need to make it more convenient to create a nullary spore
  • Should objects be allowed in paths? The reason is that they are initialized lazily, so if we don't allow lazy vals, then allowing objects (which could end up being initialized only when the spore is applied) doesn't make a lot of sense.

About

Scala Spores, safe mobile closures

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%