-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove repr #2
Remove repr #2
Conversation
This echoes the change in 4.14 to avoid calls to repr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice! I put a few minor comments / suggestions in the code.
I think the main downside of this approach is that the division of labor between Types.Layout
and Type_layout
is now pretty unclear. I think this is an improvement anyway, but I'd like to discuss what the right division is before merging.
One example is that it seems odd for equate
to be in Layout
while intersection
is in Type_layout
. Maybe all of the basic operations on the lattice should go in Types? I suspect the primary reason you didn't move them is that you didn't want to move Violation
. Maybe it's just fine to move it? I see we also have some error information for modes in Types
.
Alternatives: If we're concerned about cluttering types.ml
, we could move the Layout
and Sort
modules to their own file, to be included by Types
. (One could imagine doing the same for the mode stuff). Or we could move equate
back into Type_layout
- I think for this you just need to expose a way to modify Sort.var
s?
It also feels a bit murky to me why things like Type_layout.of_const_layout
and the void defaulting functions belong in that module rather than Types
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review.
The short answer to your "why is the division the way it is" is that I was trying to disturb as little earth as possible. But you seem to be encouraging me to disturb more earth, and so I'll take another more maximal spin. I think various module dependencies will stop us from fully merging Type_layout
into Types
, but I'll try to make this all more rational.
By the way, the idea of moving this stuff out of Types and into a module under Types is plausible, but I don't think all that necessary -- I'm not particularly worried about bloat in Types. It's a good move to have in mind, though, if it looks like it will solve a problem.
Totally reasonable - and I'm happy to be told the current split is the best compromise - but it's worth a little thought about whether moving more or less stuff would make it easier to guess where to look for a given function. |
OK. Ready for re-review. The second new commit moves everything out of Type_layout and into Types. I'm not 100% sure this is the best, but I couldn't come up with a good reason to separate things, and the move seemed in keeping with the treatment of e.g. Alloc_mode at the bottom of the Types module. |
Thanks. This looks good - merging. I won't be surprised if we get told later to move some stuff back out of types, but I agree it's hard to come up with an intuitive division of labor. |
Rebasing my remove-repr patch was pretty easy. I think this is probably worth reviewing and merging quickly to avoid future conflicts.