4 ms·
That’s abstraction breaking. The code calling add should generally not need to be aware of the implementation details of add. The users of the add API should ge
by catlifeonmars 5y ago
That’s abstraction breaking. The code calling add should generally not need to be aware of the implementation details of add. The users of the add API should generally not need to be aware of the implementation details of add.
- couchand 5y agoIn the case of a Galois field I think you're always intentionally reaching for the tool, you use it because of those implementation details. Making sure the struct's name clarifies that that's how the arithmetic works is appropriate. In that case you definitely want to implement the standard Add trait, so the user can naturally write their maths. They've already opted in to the behavior with a call to Gf2::from.