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

Concrete ident for coq #1073

Closed
wants to merge 2 commits into from
Closed

Conversation

cmester0
Copy link
Collaborator

@cmester0 cmester0 commented Oct 30, 2024

Move concrete ident modifications for Coq backend (#987) to separate PR.

@cmester0 cmester0 force-pushed the coq-generic-printer branch from abdcd67 to 9e36cb0 Compare October 30, 2024 09:55
@cmester0
Copy link
Collaborator Author

For Coq I cannot name tuple fields, 0,1,2,.., furthermore fields need to be unique, so we should use the path in the name of the fields. This naming also has to be consistent when used elsewhere, so I changing this in concrete ident.

@cmester0 cmester0 force-pushed the coq-generic-printer-concrete-ident branch from 96e7a0e to 3305abc Compare October 30, 2024 10:37
@cmester0 cmester0 force-pushed the coq-generic-printer branch from 390a82a to 1abd124 Compare October 30, 2024 10:53
@cmester0 cmester0 force-pushed the coq-generic-printer-concrete-ident branch from 73ae346 to f0517ad Compare October 30, 2024 10:57
Base automatically changed from coq-generic-printer to main October 30, 2024 11:38
Arguments t_Foo:clear implicits.
Arguments t_Foo.

Record t_Bar : Type :=
{
0 : t_Foo;
t_Bar_0 : t_Foo;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a solution to tuple structs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think enum_constructor_name_transform will do the job as well.
Such a choice need to be backend specific

@@ -47,13 +47,13 @@ Export Hax_lib (t_int).

Record t_Foo : Type :=
{
f_field : t_u8;
t_Foo_f_field : t_u8;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a solution to overlapping field names in structs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see!
Then you need to improve the name policies API: the binding enum_constructor_name_transform is what you want, but you need to add an extra argument "struct_name" or something, just as I did for enum_constructor_name_transform.
Do you see what I mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, yes. Makes sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😃
Let's chat if something looks odd or whatever, I'm available, just ping me if needed :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will also fix the issue I had, with overwriting keywords (e.g. end).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! 🎉

@cmester0 cmester0 marked this pull request as draft October 30, 2024 12:31
@cmester0 cmester0 force-pushed the coq-generic-printer-concrete-ident branch from f0517ad to 1587ec2 Compare October 30, 2024 18:50
@cmester0 cmester0 force-pushed the coq-generic-printer-concrete-ident branch from 1587ec2 to 14904e9 Compare November 4, 2024 15:25
@cmester0
Copy link
Collaborator Author

Closed in favor of #1108, which has more features

@cmester0 cmester0 closed this Nov 19, 2024
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