PreliminariesLet's call a polymorphic type F[T] enveloping if it's equipped with and (reify often being a macro) satisfying and .
A typical and motivating example where is a macro is Expr[T]. Examples where no macros are involved are Future[T] (with as ) and Option[T] (with as ).
Autounboxing is the following behaviour: whenever a value of the enveloping type F[T] is found where a value of type T is accepted, is called implicitly. In homoiconic lauguages (including Scala), one can consider all written expressions to be initialy of the type Expr[T] and being autounboxed into T by omnious implicit autounboxing rule Expr[T] => T.
ProposalWe propose to introduce an instruction which enables autounboxing for F in its scope, and quotation brackets which temporarily disable autounboxing.
Implicit contexts can be implemented by means of macros as follows: In every implicit[F]-scope the processing macro defines F.reify as an implicit conversion trom F[T] to T and applies F.eval to every occurrence of a symbol having or returning type F[T] which is defined outside of this implicit[F]-scope (symbols defined inside the scope are to be left alone). Code inside corresponding quotation brackets is excluded from processing.
Use casesCode using futures and promises can be made much more readable by autounboxing. To take an example, one can look at Dataflows in Akka 2.0. This is how their code looks now:
Using autounboxing this can be recast without any unintuitive empty paranthesis:
The main purpose of this syntax is however to be understood in course of the scala purification programme, in which all mutable (volatile) values are distinguished on type level.