Skip to content
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 type name from RowType #82

Open
joshsh opened this issue May 19, 2023 · 5 comments
Open

Remove type name from RowType #82

joshsh opened this issue May 19, 2023 · 5 comments

Comments

@joshsh
Copy link
Collaborator

joshsh commented May 19, 2023

The type name on hydra/core.RowType is not part of the LambdaGraph spec, but it is present in Hydra for historical reasons. It is redundant with the element name unless there is some reason Hydra still needs it. Look into eliminating it. Term-level nominal constructs such as Record will retain their type names.

@joshsh
Copy link
Collaborator Author

joshsh commented Jun 9, 2023

Note that wrapper types now also have a type name, for symmetry with row types. Try to remove both in parallel.

@joshsh
Copy link
Collaborator Author

joshsh commented Aug 12, 2024

Also: since #132 is now landed, RowType will go away completely, reducing to list Field.

@joshsh
Copy link
Collaborator Author

joshsh commented Aug 12, 2024

Also also: once RowType is gone, the notion of placeholder names in schema module definitions will go away as well, and the Types DSL will become slightly simpler.

@joshsh
Copy link
Collaborator Author

joshsh commented Aug 14, 2024

Investigated today. The two places where the embedded type name are really needed are in the Haskell and Java coders. Because of the way inference works right now (i.e. because the result of inference for a term like record_LatLon{lat = 37, lon = -122} is record_LatLon{lat : num, lon : num}, not LatLon) the type names need to be there. If/when inference over nominal terms produces type names rather than type definitions, then names can be removed from RowType and WrappedType.

@joshsh
Copy link
Collaborator Author

joshsh commented Aug 14, 2024

Removing embedded type names from the Haskell and Java coders might actually be possible without changes to inference, by more carefully distinguishing between type references and type definitions - but digging a little deeper, another place where the embedded type names are used is in TermAdapters. They are particularly needed when record, union, and wrapped terms are encoded in a format (like JSON) which does not preserve the type name. The round-trip to the simpler format and back will be a lossy transformation unless the type name is present at the type level. That again requires a variable type which can be dereferenced to a record, union, or wrapped type without losing track of the name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant