7.10 Static Information
space |
definition | |||
|
See Annotations and Static Information for an example.
Returns a syntax object for an expression equivalent to expr_stx, but with the static information statinfo_stx attached. The statinfo_stx information must be in unpacked form (i.e., statinfo_meta.pack is applied automatically).
See Annotations and Static Information for an example.
Converts static information described by statinfo_stx into an opaque internal format. The given statinfo_stx must match the form
((key_id, val), ...)
Keys for static information are compared based on binding, not merely the key’s symbolic form. Key identifiers should be defined with statinfo.key.
See Annotations and Static Information for an example.
The inverse of statinfo_meta.pack. This function is potentially useful to parse a result from statinfo_meta.lookup for a key whose value is packed static information.
function | ||
| ||
| ||
function | ||
|
Analogous to statinfo_meta.pack and statinfo_meta.unpack, but for a sequence of static information sets, such as one set of static information per value produced by a multiple-value expression (see statinfo_meta.values_key).
An unpacked sequence is represented as a group syntax object, where each term in the group is unpacked static information in the sense of statinfo_meta.pack.
function | |||
|
Finds static information for expr_stx, which might be a name with static information associated to its binding, or it might be an expression with static information associated directly. The result is a syntax object for the value associated to key in that static information, or #false if no information or value for key is available.
When expr_stx is an expression, consider using expr_meta.parse_more to reveal additional static information by forcing an earlier expansion of the expression. Use the result in place of expr_stx, instead of continuing to use expr_stx (which could cause parsing and expansion to happen a second time for the same expression). A potential drawback of forcing expansion is that it might constrain the order of definitions in a recursive definition context; as a convention to limit such problems, avoid expansion of terms that are nested within a block.
Keys for static information are compared based on binding, not merely the key’s symbolic form. Key identifiers should be defined with statinfo.key.
function |
fun statinfo_meta.union(statinfo_stx :: Syntax, ...) :: Syntax |
|
function |
fun statinfo_meta.intersect(statinfo_stx :: Syntax, ...) :: Syntax |
definition | ||||||
| ||||||
| ||||||
|
Typically, a definition statinfo.key id should be paired with a definition meta def id_key = 'id' so that id_key can be used directly as a key, instead of 'id'.
When a static information key is not an identifier bound via statinfo.key, then default union and intersection operations are used for the key’s values. The default functions use the same merge operations as statinfo_meta.call_result_key, which means that they merge nested static information.
value |
|
value |
|
value |
|
value |
|
value |
|
value |
|
value |
|
value |
|
value |
|
value |
Values that can be used to associate static information with an expression:
statinfo_meta.call_result_key —
packed static information for the result value if the expression is used as a function to call statinfo_meta.index_result_key —
packed static information for the result value if the expression is used with [] to access an element statinfo_meta.index_get_key —
an identifier bound to a function to call (instead of falling back to a generic dynamic dispatch) when the expression is used with [] to access an element statinfo_meta.index_set_key —
an identifier bound to a function to call (instead of falling back to a generic dynamic dispatch) when the expression is used with [] to update an element statinfo_meta.append_key —
an identifier or a boxed identifier bound to a function to call (instead of falling back to a generic dynamic dispatch) when the expression is used with ++ to append the result of another expression; for a boxed identifier, the application will be guarded by a check to ensure that both arguments share the same append implementation statinfo_meta.dot_provider_key —
an identifier bound by dot.macro dot.macro_more_static to implement the expression’s behavior as a dot provider, or a packed sequence of such identifiers. In the case of a sequence, the first identifier is used, but the rest is relevant for an intersection of two sequences, which produces the shared tail, and the union of two sequences, which picks the longer of two sequences when one is a tail of the other. statinfo_meta.sequence_constructor_key —
an identifier bound as a variable or a macro that is wrapped around an expression to create or specialize a sequence for for, or #true to indicate that no wrapper is needed statinfo_meta.sequence_element_key —
packed static information for the elements of the expression as a sequence used with each; for a sequence with multiple values in each element, the static information can map statinfo_meta.values_key to a group of per-value static information; the number of static information must be consistent with the bindings, otherwise no static information will be propageted at all; when statinfo_meta.sequence_element_key is not specified, each uses statinfo_meta.index_result_key statinfo_meta.values_key —
a packed group of static information (see statinfo_meta.pack_group), one for each value produced by a multiple-value expression statinfo_meta.indirect_key —
an identifier whose static information is lazily spliced in place of this key and identifier
See Annotations and Static Information for examples using some of these keys.
class clause |
static_info: body; ... |
|
interface clause |
static_info: body; ... |
|
veneer clause |
static_info: body; ... |