AngouriMath

Navigation

RewriteRuleSet


← Back to list of classes

Description

Summary

A named, attributable group of rewrites — the unit this library has always written
them in — carrying what it is called, what it claims and how well justified the
claim is, so that the set can be enumerated, tested and referred to by name instead
of only being called.

Remarks

The set, rather than the single pattern -> replacement line, is the unit
here because that is what has been built so far — not because the finer grain
is too expensive. It was asserted here that it would be, on the grounds that each
rule would cost a delegate call per node; measuring it found the opposite, and the
measurement is in
#825: rules
bucketed by the node type they match run as fast as the hand-written switch at realistic set sizes and faster at small ones, because a large switch over
distinct node types is compiled into that same dispatch anyway.
What actually stands in the way is transcription: splitting forty switch arms
by hand is forty chances to change a pattern silently. That points at a source
generator over the existing bodies rather than at leaving the rewrites unnamed. See
#746 item 50,
and note that nothing here forecloses it: a set whose rewrites become individually
addressable keeps the same name and the same entry in the registry.

Members

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online