Skip to content

Dependency loop OutputFormat/OutputFormatter #895

Open

Description

@oliverklee

Both have references to an instance of each other. Dependencies should go only one way, though, and loops are a really bad thing.

Activity

  1. JakeQZ commented on Feb 11, 2025

    @JakeQZ
    Collaborator

    We're talking about class dependencies, rather than object dependencies. A linked-list in C++ (before stdlib) would have loops in the objects, but they would all be of the same class.

    As I understand, OutputFormat is where the settings are, and OutputFormatter is the worker. So OutputFormatter should have a reference to OutputFormat, but there shouldn't be a need for one the other way.

  2. JakeQZ commented on Feb 11, 2025

    @JakeQZ
    Collaborator

    We would need to change the various render methods to take an OutputFormatter argument instead of an OutputFormat. To begin with, they would need to be able to accept either, with the latter deprecated. I'm assuming there's already an easy means for users to create an OutputFormatter from an OutputFormat. If we tread this path, it means we can't mark OutputFormatter as @internal. Thoughts welcome...

  3. oliverklee commented on Feb 11, 2025

    @oliverklee
    CollaboratorAuthor

    I've proposed a path forward in #907.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions