Named product properties in generated code #22
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This does not change the s-expression representation of products but changes the type universe grammar to require names for elements of products. Previously they were only required for records. The names will be used for the Kotlin properties which represent those elements.
The reason for this change is to improve the readability of the generated code. The unreadability of the synthetic names became very apparent in this PR, where for example, the synthetic name "expr2" is used to represent a
let
-body on a PIG-generatedproduct
type.After this change,
product
elements are given names which are used only in the generated code.This represents a somewhat significant change in the grammar of type universe files, even if it is a simplification. Namely, within sum types, the keyword
product
orrecord
must now be used to indicate the type of variant-tuple. PIG used to detect the type of tuple by the syntax that was in use, but now that both products and records both require their elements to be named, another method was required.Start by reviewing the changes in
README.md
, and review the rest in the order of your preference.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.