|
The Identifier is the defining occurence of a variable name, and the
eExpr is the ValueGuard-expression.
When matched against a specimen, a FinalPattern defines the variable to
have as its value the specimen as coerced by the ValueGuard. A variable
declared by a FinalPattern may not be assigned to, and programs that contain
such an assignment must be statically rejected. XXX
The current E implementations only rejects such assignments dynamically,
not statically.
|
Noun ":" eExpr
|
|
<!ELEMENT finalPattern (Noun, %eExpr;)>
|
|
A variable defined by a FinalPattern is always simple. The guard
":any" has a statically known meaning, since "any"
is an unshadowable name bound in the universal scope. Given that
"T" below is statically determined to be a particular
Java class, and using "foo" for all other ValueGuard
expressions, we have the following cases:
x :any
|
final Object x = specimen;
|
x :T
|
final T x = E.as(specimen,
T.class,
optEjector);
|
x :foo
|
final Object x = E.call(foo,
"coerce",
specimen,
optEjector);
|
|
|
def a :foo := b
|
|
same |
|
<defineExpr>
<finalPattern>
<Noun>a</Noun>
<Noun>foo</Noun>
</finalPattern>
<Noun>b</Noun>
</defineExpr>
|
|
final Object a = E.call(foo, "coerce", b, null);
|
x |
|