Skip to content
phaller edited this page Oct 10, 2011 · 25 revisions

Scala-Virtualized is an experimental 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:

  1. 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).

  2. extension methods: define new infix-methods on existing types (pimp-my-library with less boilerplate)

  3. transparent proxies: re-route all method calls on these proxy objects to a forwarder method

Material in This Wiki

Tutorial source code is available here.

Eclipse Update Site

NOTE: the build of the Scala Eclipse plugin based on virtualized Scala is experimental (the build, not the code of the plugin itself)! Please use a separate Eclipse installation (and workspace) when installing the virtualized Scala plugin for Eclipse.

That said, simply point a fresh install of Eclipse classic 3.7 to our virtualized-scala update site (built nightly). You'll probably see a security warning during the installation as we are not yet signing the plugin. Please see the official plugin website for more details and up-to-date instructions.

Be sure to enable -Xexperimental in the plugin's advanced compiler settings if your code requires e.g., applyDynamic.

Binaries

The latest distribution (built nightly) of the virtualized Scala compiler and library is available as a zip-file. Archived nightlies are also available.

Additionally, the nightly artifacts are published to scala-tools.org as version 2.10.0-virtualized-SNAPSHOT, so they are readily available as maven dependencies.

To get a feel for the build stability, please have a look at our Jenkins dashboard. The downloads above are only made available if all tests pass, barring currently known issues.

Here is a sample build.sbt file for use with the Simple Build Tool (SBT):

name := "My Scala-Virtualized Project"
version := "1.0"
resolvers += ScalaToolsSnapshots 
scalaVersion := "2.10.0-virtualized-SNAPSHOT"

Known Issues

Some corner cases with the continuations plugin still need to be resolved.

Development process

Developers push to virtualized-mostrecent, which Jenkins continuously integrates into virtualized-master. Nightlies are built from virtualized-master and published to scala-tools.org as version 2.10.0-virtualized-SNAPSHOT. Every morning, plain vanilla Scala's master is automatically merged into virtualized-mostrecent (which is then built by Jenkins, and if successful, merged into virtualized-master and pushed back to github).

Related Projects

Scala-Virtualized is actively used in a couple of open source projects:

Community

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!

Clone this wiki locally