parrotcode: Untitled | |
Contents | Language Implementations | Perl6 |
Represents a semantic context.
A Context
object supports the following operations:
It might be useful to allow multidimensional tuples by making the definition recursive,
i.e.
allowing the type to be an array of Context
s rather than typenames.
It would also be good to get rid of the third by handling overloading.
An item evaluate in PerlArray
context must return an array -- doing otherwise leads to a propagation of ugly special cases,
and breaks flattening horribly.
*
prefix operator.
Flattening contexts are also created implicitly in a number of places,
such as when passing parameters to a sub with no parameter list,
and when assigning to an array.^
on an adjacent operator.
Currently unused,
as it's easier to just brute-force hyper-operation during code generation.undef
,
for lists/tuples,
the number of elements in the tuple.$ctx
.$ctx
and $ctx
are "the same".P6C::Context
also defines the following variables:
%P6C::Context::CONTEXT
maps operator names to Context
s or,
in a few messy cases,
code refs.
Infix and suffix operators are named "infix X" and "suffix X" where X
is the operator symbol.
The messy cases include things like if
,
which don't play well with our current notion of context.
I'm not sure if
can ever really be handled in a standard way,
since it takes an arbitrary number of parameters of particular types.
|