[Discuss][UX] IRFunctor
vs ExprFunctor
and other naming issues #187
Description
As discussed in the community meeting, ExprMutator
and ExprVisitor
somewhat confusingly also traverse binding blocks, which are statements rather than expressions. What is even more interesting is that these inherit from ExprFunctor
, which does not traverse binding blocks. By contrast, IRFunctor
(which is only used in one place in the codebase) does traverse binding blocks, but is not the parent class of ExprMutator
and ExprVisitor
. The naming here is very confusing and should probably be straightened out.
There are a few routes we could take (these are not exhaustive):
- Eliminate
ExprFunctor
and renameExprMutator
andExprVisitor
toIRMutator
andIRVisitor
. - Rename the current
ExprMutator
andExprVisitor
toIRMutator
andIRVisitor
but maintain the distinction.
The main question is whether we have a need for functors that operate only on exprs and not on bindings. Option 1 seems like it probably wouldn't cause problems in the current state of the codebase, but who knows what the future holds. If we go with option 2, should we have a visitor just for binding blocks (a StmtVisitor, say)?