Skip to content

Enhance equals3 and EqualityResults with better path information, to enable value-diffing #735

Open
@blerner

Description

@blerner

Currently, EqualityResults are defined with a not-equal(reason :: String, val1, val2) constructor, and the reason field isn't terribly useful. It's almost anti-useful, because we do a bunch of JS string concatenations, and then never use the string result anywhere.

I propose we change this field to be a POpaque wrapping a raw JS object(-tree), that in some form or another encodes all the not-equal or unknown comparisons that have been made. I suggest a POpaque here because (a) this field is of no use to Pyret code anyway (it's currently not used, and we possibly could use it reflectively to determine facts about things that should be Unknown), (b) equality is called a lot and I don't want to slow it down with lots of Pyret-object allocations, and (c) I want it to be useful for CPO (see below), so it only really needs to work from JS.

The goal would be to create a "visual value diff" in CPO, that exploited the rich HTML structure of the renderValueSkeleton output, and upon mousing over any given field, could highlight the corresponding one in the other value, and color-code them as equal, not-equal, or unknown.

I really want this for error messages, as a "(show difference)" link beside the two values for when values get big, to highlight their distinctions more clearly.

I'm happy to work on this, but it might be a fun, fairly self-contained project for someone to jump on -- any takers?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions