Skip to content

Migrate FormObjectToJSON to use visitor pattern #44

Description

@darianmiller

Once Delphi.Forms.Visitor (#41) ships, evaluate migrating the JSON
serialization in Delphi.Forms.JSON to use the visitor for traversal.

This migration is less straightforward than NormalizeForm or Statistics
because JSON serialization builds a nested TJSONObject tree that mirrors
the AST hierarchy -- the visitor's flat callback model does not naturally
produce nested output. A stack-based approach in the visitor (push/pop
JSON objects on enter/leave) can work but adds complexity.

Scope

  • Evaluate whether the visitor pattern simplifies or complicates the
    JSON serialization code
  • If beneficial: implement a TJsonVisitor with a JSON object stack
  • If not beneficial: document the decision and close as won't-fix
  • If migrated: all existing JSON tests pass with identical output
  • FormFileToJSON and FormObjectToJSON public API unchanged

Acceptance criteria

  • Decision documented (migrate or skip with rationale)
  • If migrated: all JSON tests pass, public API unchanged
  • If skipped: ticket closed with explanation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions