Skip to content

Commit

Permalink
Dependency: Convert to a discrete type
Browse files Browse the repository at this point in the history
A major issue when dealing with the 'Dependency' type is that it evolved from a simple type,
which stored a version range and perhaps one or two boolean,
to one that stores 4 kinds of dependencies: version range (including exact version),
branches, repository + hash, and path.
Instead of using a discrete type (e.g. a tagged union), the type is a mix of style,
and repository and branch are piggybacking on the field used for the version range.

Switching to std.sumtype makes interaction between fields more obvious.
Most importantly, it forces the programmer to answer the hard questions,
such as how do we compare completely different dependency (version vs repository).

Hopefully this will make the code easier to understand, and in the future,
make it easier to add a new kind of dependency.
  • Loading branch information
Geod24 committed Jul 18, 2022
1 parent eb5e811 commit 4e86806
Showing 1 changed file with 162 additions and 105 deletions.
Loading

0 comments on commit 4e86806

Please sign in to comment.