Open paulstansifer opened 3 years ago
Named repeats (actually, repeat groups; they don't need to be named) can't go away. For Custom
walks, we can rely on the user naming all of the repeats that need to be walked together, but for LiteralLike
walks, we need the walk process to automatically co-march everything in the same group. The only place that tests enforce this is mu_type
, but for a clearer example, imagine a match
that's been quoted (so we're walking it LiteralLike); we need each arm to import from its pattern; we don't want to rewrite those imports to import from all of the patterns together.
First: Don't store repeats together. Instead of
have
or even
where
or
(maybe we should drop the concept of named repeats entirely, but this issue is supposed to be semantics-neutral)
Then: Let's make
MBE
-related operation more composable. Instead ofparts.map_reduce_with(parts2, mapper, reducer)
, we should writeEnvMBE::zip(parts, parts2).map(mapper).reduce(reducer)
If this makes performance significantly worse we should (sigh) introduce something analogous to an iterator for MBEs.
Also: I think that
MBE
in this name doesn't really make sense. The variety of things that we're calling "dotdotdot" have more to do with Macro By Example than this does. MaybeStarEnv
?Starsoc
?And then (#38) it seems like we'll replace
Vec
withExampleVec
... hope this actually winds up being a simplification!