Commit Graph

1 Commits

Author SHA1 Message Date
Nik Clayton 3a274b0594
refactor: Replace .to... with .from() in most cases (#82)
The previous code generally converted between a higher and a lower type
by putting the type conversion functions on the lower type.

This introduced cycles in the code dependency graph, and made it more
difficult to follow the code flow.

Refactor the code so that types generally have a `from(...)` static
factory method that can create an instance from a lower type, and if
appropriate a `to...()` method that can also create an instance of that
lower type.

Add `docs/code-style.md` which explains the rationale for this change
in more detail so that future contributors can write code in the same
style.
2023-09-22 15:17:38 +02:00