Skip to content

introduce a Visit trait to go with Fold #333

Closed
@nikomatsakis

Description

@nikomatsakis

Right now we have a Fold trait that is used to transform types and other bits of IR. But sometimes we don't need to recreate the IR, we instead want to compute a value (e.g., count all the types etc). You can model this as a folder with mutable state, but it'd be more efficient to have a "visitor" trait.

Some examples where this would be useful:

  • the truncator is right now only used to detect when terms get too big
  • the UCollector
  • the needs_shift method
  • some upcoming work as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good issue to start working on Chalk with

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions