Skip to content

Make the difference between maps and lists more explicit #100

@JeroenDeDauw

Description

@JeroenDeDauw

Background: the map/list distinction was not present in the very first versions as got hacked in, leaving something that is not explicit and clean.

Terms:

  • Map: associative array. Key matters. Diffs can contain change operations and diffs
  • List: array with numeric keys. Comparison by values. Diffs can only contain add and remove operations

Pain points:

  • Only one Diff class, rather than a MapDiff and ListDiff. (Those classes actually existed at some point, though as subclasses of Diff, inheriting nearly everything)
  • The Diff class takes an $isAssociative flag, though constructing it with this set to false AND associative operations results in no error
  • The Diff class is a mess
  • All differs implement the Differ interface. All services needing a differ just request a Differ. Since the Differ has no info on if it is doing an associative diff, such services cannot restrict the type of differ, know what kind of operations to expect or know what flag to pass to the Diff class.
  • Non-associative patchers (and other services) cannot clearly specify they only deal with non-associative diffs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions