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

refactor(ast_codegen): use doc comments instead of endl! #4778

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Aug 9, 2024

Similar to #4777.

Use ///@@ instead of endl!(); in AST codegen to create line breaks.

NB: ///@@ needs to be before an item, not after it.

Copy link

graphite-app bot commented Aug 9, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link

codspeed-hq bot commented Aug 9, 2024

CodSpeed Performance Report

Merging #4778 will not alter performance

Comparing 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ (2c1c705) with main (f418f62)

Summary

✅ 29 untouched benchmarks

@rzvxa rzvxa force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ branch from d5f689c to ee406fa Compare August 9, 2024 07:19
@rzvxa rzvxa force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from 93546af to 9c53522 Compare August 9, 2024 07:20
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ branch from ee406fa to 7713818 Compare August 9, 2024 07:33
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from 9c53522 to a861c31 Compare August 9, 2024 07:33
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ branch from 7713818 to ef525ec Compare August 9, 2024 07:39
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from a861c31 to 1e25ab5 Compare August 9, 2024 07:39
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ branch from ef525ec to bb2cd39 Compare August 9, 2024 07:49
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from 1e25ab5 to 992f1cd Compare August 9, 2024 07:50
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ branch from bb2cd39 to 1605fa1 Compare August 9, 2024 07:52
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from 992f1cd to 2562cd7 Compare August 9, 2024 07:57
@overlookmotel overlookmotel changed the base branch from 08-09-refactor_ast_codegen_use_doc_comments_instead_of_insert_ to graphite-base/4778 August 9, 2024 08:19
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from 2562cd7 to e0d978c Compare August 9, 2024 08:22
@overlookmotel overlookmotel changed the base branch from graphite-base/4778 to main August 9, 2024 08:23
@overlookmotel
Copy link
Contributor Author

overlookmotel commented Aug 9, 2024

@rzvxa I'm less sure about this one than #4777.

Reasons I prefer ///@@ to endl!():

  • Because it's a comment, it's clearer that it's incidental and not part of the output code.
  • VS Code colours the comments in green, so the code is more broken up visually, which makes it easier to read.

What I don't like:

  • What the fuck does ///@@ mean?!

On balance I do prefer ///@@, but what do you think? Would it be clearer if it was ///@@<line break>? Or are you completely opposed?

@rzvxa
Copy link
Contributor

rzvxa commented Aug 9, 2024

@rzvxa I'm less sure about this one than #4777.

Reasons I prefer ///@@ to endl!():

* Because it's a comment, it's clearer that it's incidental and not part of the output code.

* VS Code colours the comments in green, so the code is more broken up visually, which makes it easier to read.

What I don't like:

* What the fuck does `///@@` mean?!

On balance I do prefer ///@@, but what do you think? Would it be clearer if it was ///@@<line break>? Or are you completely opposed?

I'll let you decide on this one, As long as we can generate the same output it doesn't matter.

@overlookmotel
Copy link
Contributor Author

We could make our own proc macro which wraps quote! and figures out where line breaks are from the spans of tokens, and inserts endl!(); for us in those places. So then we could just write the code normally and avoid all this nonsense. But it seems like overkill to me to have a proc macro purely for use in the codegen.

Copy link

graphite-app bot commented Aug 9, 2024

Merge activity

  • Aug 9, 4:56 AM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Aug 9, 4:56 AM EDT: overlookmotel added this pull request to the Graphite merge queue.
  • Aug 9, 5:01 AM EDT: overlookmotel merged this pull request with the Graphite merge queue.

@overlookmotel
Copy link
Contributor Author

OK, thanks. I'm going to merge it. Might go back and change it ///@@<line break> later on.

Similar to #4777.

Use `///@@` instead of `endl!();` in AST codegen to create line breaks.

NB: `///@@` needs to be before an item, not after it.
@overlookmotel overlookmotel force-pushed the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch from e0d978c to 2c1c705 Compare August 9, 2024 08:57
@graphite-app graphite-app bot merged commit 2c1c705 into main Aug 9, 2024
24 checks passed
@graphite-app graphite-app bot deleted the 08-09-refactor_ast_codegen_use_doc_comments_instead_of_endl_ branch August 9, 2024 09:01
rzvxa pushed a commit that referenced this pull request Aug 9, 2024
Follow-on after #4778. `///@@line_break` is more verbose, but it's clearer what it does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants