Scala-Virtualized is a branch of the Scala compiler and standard library that contains a few additions to provide even better support for embedded DSLs (we call that language virtualization).
The key features are as follows:
overloadable control structures (while-loops, if-then-else, pattern matching), variables, object creation, etc. Scala has always translated for-comprehensions into method calls, so that the programmer can change the meaning of a for-comprehension by implementing these methods in a certain way. We generalize this to all control flow operators, as well as to the representation of mutable variables and object creation (for now limited to struct-like datatypes, but providing precise types for field-selection).
extension methods: define new infix-methods on existing types (pimp-my-library with less boilerplate)
Tutorial source code is available here.
Releases of Scala-Virtualized are binary compatible with the corresponding regular Scala release.
Here is a sample
build.sbt file for use with the Simple Build Tool (SBT):
name := "My Scala-Virtualized Project" version := "1.0" scalaVersion := "2.10.0" scalaOrganization := "org.scala-lang.virtualized"
Scala-Virtualized is actively used in a couple of open source projects:
Community support is available on the regular Scala mailing lists. Posts should mention scala-virtualized in the subject line.
Using Scala-Virtualized for your project? Please let us know!
Last edited by pvorb,