Open PawelLipski opened 2 years ago
I looked at the MacheteClient
fields that keep state of the git machete and i see that the code very heavily depends on the state being mutable and i am not sure if its worth the effort and whether it would significantly improve the code quality. Could you maybe provide with some pros/cons or use cases besides the only one: for managed_branch in self.managed_branches.copy():
.
Nevertheless, here are the possible solutions:
Pros:
Cons:
Pros:
Cons:
Pros:
Cons:
Cons:
Pros:
Cons:
@PawelLipski wdyt?
Hmmm okay, indeed lack of a single clear solution here... let's freeze this issue for some time, if serious problems (race conditions? but not very likely as almost everything is synchronous in this CLI) related to lack of immutability start occurring, we'll revisit
This has been done in https://github.com/VirtusLab/git-machete-intellij-plugin using vavr.io, with very good results. While CLI is less prone to race conditions on data structure as compared to GUI, it'd be still good to switch to immutable structures (to avoid the need for
.copy()
etc.).As a first point, let's research what options for immutable structures are available in the ecosystem... esp. if anything is available in the standard library so that we don't need to add external deps 🙏🏻