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

[Merged by Bors] - fix(init/meta/interactive_base): Use }} in format #650

Closed
wants to merge 3 commits into from

Conversation

digama0
Copy link
Member

@digama0 digama0 commented Nov 12, 2021

As discussed on Zulip. This way, escaped braces are balanced. That is, format!"a{{b}}c" produces "a{b}c", instead of format!"a{{b}c". Unbalanced braces are bad for editors and formatters, so we should not encourage any syntax that requires unbalanced braces.

This way, escaped braces are balanced.
That is, `format!"a{{b}}c"` produces `"a{b}c"`, instead of
`format!"a{{b}c"`. Unbalanced braces are bad for editors and formatters,
so we should not encourage any syntax that requires unbalanced braces.
@kmill
Copy link
Contributor

kmill commented Nov 12, 2021

It seems like the only modules in mathlib this will obviously affect are in src/tactic: core.lean, monotonicity/interactive.lean, pretty_cases.lean, squeeze.lean, and transfer.lean.

Mathlib seems to have its own version of format!, too, in src/tactic/core.lean (see parse_pformat), which is used in the trace! macro, and src/tactic/simps.lean has a case of {{. (I'm not sure I didn't miss anything.)

@digama0
Copy link
Member Author

digama0 commented Nov 12, 2021

I expect very few changes in mathlib. format! and friends are used rarely, and {{ in format even more rarely. I was planning to defer this until after it lands and we are working on the mathlib bump PR, but this should be an exhaustive enumeration: 1 2 3 4 5 6, plus the implementation of pformat! has to be updated.

@gebner
Copy link
Member

gebner commented Nov 12, 2021

I agree with the balancing philosophy, and wholeheartedly approve of the whitespace formatting.

bors r+

@gebner
Copy link
Member

gebner commented Nov 12, 2021

bors r+

bors bot pushed a commit that referenced this pull request Nov 12, 2021
As [discussed on Zulip](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/curly.20braces/near/261185802). This way, escaped braces are balanced. That is, `format!"a{{b}}c"` produces `"a{b}c"`, instead of `format!"a{{b}c"`. Unbalanced braces are bad for editors and formatters, so we should not encourage any syntax that requires unbalanced braces.
@bors
Copy link

bors bot commented Nov 12, 2021

@bors bors bot changed the title fix(init/meta/interactive_base): Use }} in format [Merged by Bors] - fix(init/meta/interactive_base): Use }} in format Nov 12, 2021
@bors bors bot closed this Nov 12, 2021
@bors bors bot deleted the format_brace branch November 12, 2021 11:50
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.

None yet

3 participants