Skip to content

Get rid of unnecessary layouts in the type environment#1386

Closed
goldfirere wants to merge 6 commits intorae/layout-in-type-declfrom
rae/no-inner-layouts
Closed

Get rid of unnecessary layouts in the type environment#1386
goldfirere wants to merge 6 commits intorae/layout-in-type-declfrom
rae/no-inner-layouts

Conversation

@goldfirere
Copy link
Copy Markdown
Collaborator

This follow-on to #1384 removes now-redundant information from the type environment.

My concern before starting down this road is that the information will be needed in the translation to Lambda. It's not right now because everything is a value. But that's due to change, of course. Yet then the layout information is really a property of the translation algorithm, and needn't be persisted all the way through the type checker.(*) So there's a possibility that we'd have to create a little transl_env type or something to compute the layouts before translating. This is appealing, though, because it simplifies type-checking recursive types (no need to update data that you're not storing) and eliminates duplicate information. And, if we ever start being able to handle e.g. type ('a : any) foo = { blah : int; quux : 'a; quux2 : 'a }, then we won't be able to store the layouts in the type structure anyway, because they will depend on the arguments.

(*) I still agree with the plan to keep seeking any layouts we need in the type checker. So maybe it all takes the form of a function that computes the inner layout information from the layouts of arguments, all produced in the type checker (to get e.g. good error messages). But I think it will be easier to produce such a thing when we really need it, as we're implementing structures that contain non-values.

@goldfirere goldfirere marked this pull request as ready for review May 16, 2023 14:42
@goldfirere
Copy link
Copy Markdown
Collaborator Author

This is ready for review. But see #1384 first.

@mshinwell
Copy link
Copy Markdown
Collaborator

@goldfirere who is to review this?

@goldfirere
Copy link
Copy Markdown
Collaborator Author

I discussed this with @ccasin and we decided not to proceed with this, given the likelihood that much of the information removed here will have to return in another form soon.

@goldfirere goldfirere closed this Jun 14, 2023
@goldfirere goldfirere deleted the rae/no-inner-layouts branch June 28, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants