given def OptiML[R](b: => R) = new Scope[OptiML, OptiMLExp, R](b)
given def OptiML[R](b: => R) = new Scope[OptiML, OptiMLExp, R](b)
OptiML { body }
is expanded to:
trait DSLprog$ extends OptiML { def apply = body } (new DSLprog$ with OptiMLExp): OptiML with OptiMLExp
Struct is a marker trait used to indicate that new C { ... }
should be reified.
Struct is a marker trait used to indicate that new C { ... }
should be reified.
Selections on the result e
of the reified object creation, e.x_i
,
are treated specially, as outlined below.
If there's a type constructor Rep
(of kind * -> *
) so that C <:< Struct
,
the expression new C { (val x_i: T_i = v_i)* }
is turned into
the call new(("x_i", (self_i: Rep[C{ (val x_i: T_i')* }]) => v_i')*)
,
which is typed with expected type
Rep[C{ (val x_i: T_i')* }]
For all i,
this
by a fresh variable self_i
(with type Rep[C{ (val x_i: T_i')* }]
)This assumes there is a method in scope similar to: def new[T](args: (String, Rep[T] => Rep[_])*): Rep[T]
When a selection e.x_i
does not type check according to the normal typing rules,
and e
has type Rep[C{ (val x_i: T_i')* }]
(where C
meets the criteria outlined above),
e.x_i
is turned into e.selectDynamic[T_i]("x_i")
Note why types are by-value
Note why types are by-value
Returns string formatted according to given format
string.
Returns string formatted according to given format
string.
Format strings are as for String.format
(@see java.lang.String.format).