Refactoring: use type aliases (in utils/Misc) to improve interfaces readability#2227
Refactoring: use type aliases (in utils/Misc) to improve interfaces readability#2227gasche merged 11 commits intoocaml:trunkfrom
Conversation
Well, you're adding some Btw, I don't like this PR: I'm against "transparent" type aliases, they are arguably nicer to read, but they don't really bring you any extra safety and the added information is only available at the declaration, not when used. That's of course only my personal opinion and I'd be curious to hear what you and/or other people think. |
|
I think that transparent type aliases definitely improve the situation, because they make declarations readable -- in many cases they were not before. I could not go on with my refactorings without them. If you do believe they are a strict improvement, then I think you could approve the PR. What you have in mind is indeed better, but it makes changes much more invasive as all use-sites have to be changed. It would be nice work to do, but these changes are not the focus of my work, just side-works, so I don't want to spend a lot more effort on them for now. Anyone is free to come after this change and use |
|
It's not a panacea, but there's indeed some added value in this PR. |
The advantage compared to the current situation is clear ("nicer to read") and I don't see any disadvantage. In particular, this PR does not make it more difficult to evolve to something that would bring more safety (quite the opposite actually). The only risk is that a wrong annotation could indeed be misleading, but I trust @gasche was careful enough. So count me in favor. |
|
Ack. I'm not planning to veto that PR anyway.
doesn't convince me. A docstring would have done just as well. |
|
I tend to agree with @trefis in this case, but I still think that this PR goes in the right direction. I'm not fond of putting things in Misc though. I'm pretty sure making |
Armael
left a comment
There was a problem hiding this comment.
@trefis one advantage of type aliases compared with docstrings is that it makes it easy to change the value of the alias, for example to transition from string to a better representation or an abstract type.
I think there is consensus that this PR goes in the right direction overall and makes further refactoring easier (such as the one @gasche submitted in a more recent PR).
I'm approving. @gasche : you need to make check-typo happy it seems.
0a4ac61 to
6b0e9d1
Compare
6b0e9d1 to
1d75048
Compare
|
I fixed |
This PR is the first part of a larger refactoring I've been working on for
typing/env. It should be a complete no-op, as it does not touch any runtime code, only types.(Easy to review!)