You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One issue that came out of #234 is that it should be possible to make DistroVersion more static (instead of a dynamic Enum), and verify the code correctness using the type system. This may be possible using some combination of Traits and associated types, but it was non-obvious how exactly to do that without blocking the PR for some time.
The text was updated successfully, but these errors were encountered:
I thought about this a little after seeing Dave's comment about associated types, and the only thing that immediately came to me would be inverting the control flow a little. Currently we are set up to do Inventory::fetch(tool), passing the tool that we want to fetch into a single inventory method.
If we instead made Tool into a Trait, with an associated Distro type (which itself has an associated Version type), then we could have Tool::fetch(collection), where we pass the Inventory Collection into the tool to do the fetching. We could use the associated Distro type to ensure that we are passing a Collection of the correct kind in, and getting the correct type out.
I haven't worked through all the intricacies of that approach though, perhaps I'll take a quick stab at it once #234 is merged to see if it's feasible.
One issue that came out of #234 is that it should be possible to make
DistroVersion
more static (instead of a dynamic Enum), and verify the code correctness using the type system. This may be possible using some combination of Traits and associated types, but it was non-obvious how exactly to do that without blocking the PR for some time.The text was updated successfully, but these errors were encountered: