ERights Home elang / kernel 
Back to: FinalPattern x On to: Ignore Pattern

VarPattern


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.

BNF:
"var" Noun ":" eExpr
XML DTD:
<!ELEMENT varPattern (Noun, %eExpr;)>
Java:

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);
};

 

Example:
to be written
in Kernel-E:
to be written
in XML:
to be written
in Java:
to be written

 

x
 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / kernel 
Back to: FinalPattern x On to: Ignore Pattern
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign