Skip to main content
8 events
when toggle format what by license comment
Nov 13, 2023 at 16:49 comment added J_H Excellent. Adding a github link would be helpful. I tried re-reading those 48 lines of hasher just now. I have no idea what children_option is. There's no overview, no outline. The "normally impossible" comment at line 4 just kind of knocks me off my feet before I have context, so I'm wondering "what, no processing yet, and we're already cleaning up errors?" It's correct, it's just not helping me understand. Maybe leaving out the parameter of TREE_BRANCHES and letting it be global would simplify slightly? Can the NOTREACHED panic!() perhaps be designed out of the code? Anyway, good luck!
Nov 13, 2023 at 16:42 vote accept Tristan Nemoz
Nov 13, 2023 at 16:42 comment added Tristan Nemoz Ok then I'll accept your answer and post a new question with a (hopefully) slightly better code and more detailed explanations. Thanks!
Nov 13, 2023 at 16:35 comment added J_H Two ways to win: post an Answer of your own, and/or create a brand new Question which refers to the current one. As far as "comments in tests" goes, well, potentially they can be helpful, can say more than the identifiers in the test say. But fundamentally my problem as a reviewer was that I simply didn't understand your data structure and its invariants. Spell them out clearly in the target code, and I bet your tests become self explanatory. The invariants guarantee certain behaviors, and then we test each behavior.
Nov 13, 2023 at 10:58 comment added Tristan Nemoz Concerning the tests, you're entirely right. I'm a bit puzzled about what to do in that case: I would like to edit the tests (at least add some comments to explain what I test for) so that the code becomes easier to read and understand, but from my understanding of this site's inner workings, editing the question code is frowned upon. What would be the best course of action here?
Nov 13, 2023 at 10:56 comment added Tristan Nemoz Thanks for your answer! I'll add a bit more details about what I want to do ASAP, thanks for the feedback. I did think about using a hash, the reason why I didn't is that I would like to take advantage of the fact that I don't need most of the security properties of the hash. As you've mentioned, I just need a unique serial number, I only use the term hash as I intend to use it in a HashMap later on. Do you think it would be clearer to edit the question to remove the term hash in that case?
Nov 10, 2023 at 4:34 history edited J_H CC BY-SA 4.0
added 232 characters in body
Nov 10, 2023 at 4:27 history answered J_H CC BY-SA 4.0