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

Stack alloc: option to print in JSON format #656

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eponier
Copy link
Contributor

@eponier eponier commented Nov 29, 2023

No description provided.

Copy link
Member

@vbgl vbgl left a comment

Choose a reason for hiding this comment

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

I find it weird to output this JSON data to the error output, mixed with other debug information not meant for machine consumption.

Wouldn’t it be more convenient for the user to specify a file name?

Also, there is no test of this functionality (therefore it will break).

compiler/src/dune Show resolved Hide resolved
@eponier
Copy link
Contributor Author

eponier commented Nov 30, 2023

Ok, I will print to a dedicated file.

What do you have in mind for the test? Testing this is valid JSON, that it prints the same information that the option we already have, something else?

@vbgl
Copy link
Member

vbgl commented Nov 30, 2023

I don’t have anything in mind beyond the following invariant of software engineering: untested features eventually break.

@eponier eponier force-pushed the stack-alloc-json branch 2 times, most recently from 494ba19 to 80c0dcc Compare November 30, 2023 15:30
The command line option is -json-stack-alloc filename
We check that -print-stack-alloc and -json-stack-alloc stay in sync. The
tests are not run by default by "make check".
@eponier
Copy link
Contributor Author

eponier commented Nov 30, 2023

I implemented what you suggested.

And I added a test that checks that -print-stack-alloc and -json-stack-alloc stay in sync. I find the implementation dirty (the parsing of JSON is written in OCaml and I call ocaml to interpret it), but I don't know how to do it in a cleaner way. The test is not run by default because I don't think we will touch that part really often.

@bgregoir
Copy link
Contributor

bgregoir commented Dec 5, 2023

Are we happy with this one ?

@vbgl
Copy link
Member

vbgl commented Dec 5, 2023

I now regret to have suggested to test that feature…

@eponier
Copy link
Contributor Author

eponier commented Dec 5, 2023

If you find the tests too ugly, I can just drop them. Another option, suggested by Benjamin last week, is to test the output like we do for the SCT checker.

@eponier
Copy link
Contributor Author

eponier commented Feb 7, 2024

I'd like to close this one, I think the consensus is rejection. @bgregoir, you mentioned that you wanted to discuss with Tiago about this PR, did you do it?

@eponier
Copy link
Contributor Author

eponier commented Feb 20, 2024

@bgregoir ping

@bgregoir
Copy link
Contributor

I forgot, I should do it.

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.

3 participants