|
The Identifier is the defining occurence of a variable name, and the
eExpr is the SlotGuard-expression.
In Kernel-E (our only concern here), the SlotGuard-expression may only
be "settable" or "settable(ValueGuardExpr)".
(All other cases are transformed away by deslotification.) When matched
against a specimen, a VarPattern defines the variable to have as its value
the specimen as coerced by the ValueGuard. Likewise, when such a variable
is assigned to, the new value of the variable is the rValue as coerced
by the ValueGuard.
|
"var" Noun ":" eExpr
|
|
<!ELEMENT varPattern (Noun, %eExpr;)>
|
|
By scope analysis, explained elsewhere (XXX), the variable is
determined to either be simple or boxed.
Simple |
var x :settable
|
Object x = specimen;
|
var x :settable(T)
|
T x = E.as(specimen,
T.class,
optEjector);
|
var x :settable(foo)
|
Object x = E.call(foo,
"coerce",
specimen,
optEjector);
|
Boxed |
var x :settable
|
final Object[] x__Box = { specimen };
|
var x :settable(T)
|
final T[] x__Box = {
E.as(specimen,
T.class,
optEjector)
};
|
var x :settable(foo)
|
final Object[] x__Box = {
E.call(foo,
"coerce",
specimen,
optEjector);
};
|
|
|
to be written |
|
to be written |
|
to be written |
|
to be written |
x |
|