refactor: remove [Lib_info.is_parameter]#12298
Conversation
|
As a general rule, we do not keep dead code around. Only reason it made it through is because I didn't notice it was unused. Do you plan to use this function? If so, you can easily reintroduce it where you plan to use it. |
This is already being used in the PR #12002 it was just introduced in #11963 specifically for this purpose. That is a PR you reviewed and approved. So, this is not "dead code", it's an interface introduced as part of a larger arc of work that is still in progress. If we end up deciding that revisions to #12002 -- in light of #12276 -- make this predicate useless, we will remove it there. But stepping on our toes to remove a function we just added, and are currently using in staged WIP, creates needless interference (concretely in the form of pointless merge conflicts). So would you please close this for now and let us address it in #11963 ? I'm happy to sync about this in case you feel that this imposition is critical for some reason, but IMO the easiest course of action is to let us focus on the core work here that we have in flight. I have noted this particular function for followup. |
|
It turns out I have to touch these lines in #12276 . So if you insist that this must be removed now, let's at least do it on that WIP. |
|
We don't need to remove it now. If you want to keep it around temporarily to make it easier to make progress, go right ahead. Just so we're on the same page, this function does need to go. Otherwise, the whole Lib_kind refactoring is pointless as this function just undermines the point of forcing callers to consider all the cases. I'll keep this PR so that we don't forget to do this. |
|
Thank you for being will to defer here! 🙏 To make sure that the pages are clearly enumerated
The fundamental problem with the previous implementation was a representation that allowed assert (Lib_info.is_parameter x && Lib_info.virtual_ x)even tho we know it to be an axiom that assert (not (Lib_info.is_parameter x && Lib_info.virtual_ x))I.e., it should be impossible for both predicates to be true. The
AFAIK, this cannot be enforced so long as we leave the definition of Do you think I am missing something in my analysis of the logic of the types and the limits on the limitation of expression here? Now, if as a matter of mere style, we want to discourage the use of predicate functions to abbreviate case analysis (even when that may be convenient), I am not opposed to that in principle either. Is this an existing convention that has already been agreed upon or adopted in the code base, or something you would move to introduce going forward? Either way, perhaps a PR into https://dune.readthedocs.io/en/stable/hacking.html#subjective-style-points would be in order? |
|
All of our techniques to keep the code robust rely on a certain level of co-operation and skill from the programmers. I don't know how to avoid that. I hope that all of our contributors would think twice before writing I think removing
Because this function is entirely redundant. You are welcome to expand on this point if you feel inspired.
That's what I thought when I introduced Only a substantial amount of convenience offered by an abbreviation would be enough to justify its use. In conclusion, I'd rather reject the help and supposed clarify in favor of a codebase that is easy to grep and modify. |
This function is used. We should prefer pattern matching on the library kind to using this function anyway. Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: d4514b4c-5c76-496b-9785-e354b052e26b --> Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
4bb3046 to
b65a72c
Compare
|
Sure, feel free to merge this PR and rebase yours. Or, merge your PR and then close this one. |
This function is unused. We should prefer pattern matching on the library kind to using this function anyway.
Signed-off-by: Rudi Grinberg me@rgrinberg.com