Skip to content

Merge IsGraphvizGraph, IsGraphvizDigraph and IsGraphvizContext into a single type - #121

Merged
james-d-mitchell merged 5 commits into
gap-packages:mainfrom
reiniscirpons:AllYourTypesAreBelongToUs
Oct 11, 2026
Merged

james-d-mitchell merged 5 commits into
gap-packages:mainfrom
reiniscirpons:AllYourTypesAreBelongToUs

Conversation

@reiniscirpons

Copy link
Copy Markdown
Collaborator

This PR unifies IsGraphvizGraph, IsGraphvizDigraph and IsGraphvizContext into a single type IsGraphvizGraph.
We could recover these types by re-adding them as properties, but since all of these types share the same interface, there is no need to have different constructors and filters for them.

Fixes #115 .

@codecov

codecov Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.43%. Comparing base (5169cac) to head (fcdf8ec).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #121      +/-   ##
==========================================
- Coverage   94.90%   94.43%   -0.47%     
==========================================
  Files          12       12              
  Lines        1255     1223      -32     
==========================================
- Hits         1191     1155      -36     
- Misses         64       68       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@james-d-mitchell

Copy link
Copy Markdown
Collaborator

Is it still possible to disambiguate contexts from graphs and digraphs? This is important in the changes I'm making.

@reiniscirpons

Copy link
Copy Markdown
Collaborator Author

Is it still possible to disambiguate contexts from graphs and digraphs? This is important in the changes I'm making.

Oui, g!.IsContext is true if and only if something is a context. I could add a wrapper IsGraphvizContext property which just returns this parameter if that would help

@james-d-mitchell

Copy link
Copy Markdown
Collaborator

Very good, I'll try to take a look today

Comment thread gap/dot.gi Outdated
if IsGraphvizDigraph(g) then
kind := "digraph";
elif IsGraphvizContext(g) then
if g!.IsContext then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just poor man's properties? I.e. shouldn't we just define IsGraphvizContext as a property of objects in the category IsGraphvizGraph, and likewise IsGraphvizDigraph? This is equivalent to what you're doing here in many ways, and is more "official". O/w I approve these changes.

@james-d-mitchell james-d-mitchell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change !.IsContext etc to properties of IsGraphvizGraph, then I'm happy to merge this!

@james-d-mitchell
james-d-mitchell force-pushed the AllYourTypesAreBelongToUs branch from dc95572 to 0bff575 Compare October 3, 2026 15:15
@james-d-mitchell

Copy link
Copy Markdown
Collaborator

Turned out it wasn't possible to use properties, so I re-added IsGraphvizDigraph and IsGraphvizContext. There are some good changes in this PR, but I'm not sure the one that renamed IsGraphvizGraphDigraphOrContext to IsGraphvizGraph is really the best idea.

@james-d-mitchell
james-d-mitchell force-pushed the AllYourTypesAreBelongToUs branch 2 times, most recently from d282752 to 9d355e5 Compare October 3, 2026 19:15
@james-d-mitchell

Copy link
Copy Markdown
Collaborator

In discussion with @reiniscirpons we decided to revert IsGraphvizGraph in this PR to IsGraphvizGraphDigraphOrContext but to keep the other refactoring/simplification code in this PR.

@james-d-mitchell
james-d-mitchell force-pushed the AllYourTypesAreBelongToUs branch from 9d355e5 to 41ed3e6 Compare October 9, 2026 08:46
@james-d-mitchell

Copy link
Copy Markdown
Collaborator

The rebase was non-trivial, it looks like I haven't completed it properly, please don't merge until I can come back to it.

@james-d-mitchell
james-d-mitchell force-pushed the AllYourTypesAreBelongToUs branch from 41ed3e6 to fcdf8ec Compare October 11, 2026 10:44
@james-d-mitchell
james-d-mitchell merged commit adb1bc5 into gap-packages:main Oct 11, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not separate Graph, Digraph and Context at the type level

2 participants