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

Disable \requires #3879

Merged
merged 1 commit into from Mar 24, 2020
Merged

Disable \requires #3879

merged 1 commit into from Mar 24, 2020

Conversation

opensdh
Copy link
Contributor

@opensdh opensdh commented Mar 17, 2020

Now that Mandating is complete, we can prevent accidentally using \requires by relegating the macro itself to Annex D (in a form of meta-deprecation).

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

@zygoloid: Can we not ask for reviewers anymore? (I would have picked you and @jensmaurer, as the main macro-wranglers.)

source/future.tex Outdated Show resolved Hide resolved
@JohelEGP
Copy link
Contributor

#3854 didn't move the macro. I thought this patch was suggested/done somewhere else, so I'm pointing this out so no one else loses time hunting it down.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

@JohelEGP: That's perfectly fine. I think the point of the present PR is to make it harder to accidentally reintroduce the bad words into the main standard. I'm somewhat sympathetic to that, though it's traded off against splattering even more local macro definitions into the regular text sources, which leaves me in two minds about this. It's a good proof that the "mandates" changes have landed, I suppose.

@zygoloid zygoloid self-requested a review March 17, 2020 02:28
Copy link
Member

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

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

Looks fine to me. (I'd also be OK with \renewcommand to something invalid after we're done rather than the Big Braced Block, but either way seems OK.)

Leaving it to @tkoeppe to complete his review and merge.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

(I'd also be OK with \renewcommand to something invalid after we're done rather than the Big Braced Block, but either way seems OK.)

I don't like "something invalid"—unless we use \@undefined, which exists for the purpose, but which is @-ful. Another alternative to the BBB is of course \begingroup\endgroup.

@zygoloid
Copy link
Member

I don't like "something invalid"—unless we use \@undefined, which exists for the purpose, but which is @-ful. Another alternative to the BBB is of course \begingroup\endgroup.

If we want to be truly Well Behaved, we could define an environment to hold this command. But that really seems like overkill, and I'm OK with the braces as-is.

@godbyk
Copy link
Contributor

godbyk commented Mar 17, 2020 via email

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

I would shed no tear if we just lost the braces altogether. The main purpose of this change, as far as I can tell, is to not have the macro available in most of the standard so we don't accidentlaly use it; whether a tiny bit of Annex D gets to see it is largely irrelevant.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 17, 2020

The main purpose of this change, as far as I can tell, is to not have the macro available in most of the standard so we don't accidentlaly use it; whether a tiny bit of Annex D gets to see it is largely irrelevant.

I guess I should respond (this time) to clarify the purpose: it's that (not least because the correct \expects renders as another word), and also removing it from macros.tex so that no one thinks it's part of the "standard" set of such macros. As for having the macro stay around, it's slightly unfortunate because it bleeds into other files (but not any that are likely to use it!).

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 17, 2020

Sure. I'm not really concerned with the public impression we cause with macros.tex. Yes, without braces the macro stays around for files included later, but happily, there isn't much specification content followin Annex D (anymore). So if it avoids trade-offs of unease about arbitrary-seeming braces or groups, I'd simply drop the braces.

@godbyk
Copy link
Contributor

godbyk commented Mar 17, 2020

Another option would be to drop the grouping and add a \let\requires\relax at the end of the appendix. This would prevent subsequent files from using the now-undefined \requires macro.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 18, 2020

That's a good idea. @opensdh: could you use that approach please?

@opensdh
Copy link
Contributor Author

opensdh commented Mar 18, 2020

That's a good idea. @opensdh: could you use that approach please?

I assume you mean the \let\requires\relax. That doesn't actually work; it causes LaTeX to ignore the command, not reject it. If we want a "deliberately invalid" definition, presumably \errmessage{Mandating complete} is what we want.

@godbyk
Copy link
Contributor

godbyk commented Mar 18, 2020

If you want it to show an error instead of silently doing nothing, then you'd use:

\makeatletter
\let\requires\@undefined
\makeatother

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 18, 2020

@opensdh: ignoring the command seems unconcerning. What's the threat model you're trying to combat here? A DOS attack of \requires macros? All I was thinking we want to avoid is an accidental motion application with the old wording, and if the macro produces no output, that should produce a sufficiently obvious visual defect, don't you think? Of course a build error would be even better, but it feels like a rather minor improvement.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 18, 2020

I mentioned both \begingroup and \@undefined already; neither seemed (to me!) an improvement over the braces. I'm not trying to combat any threat, just make it structurally clear how this macro is supposed to be (not) used (and not rely on visual inspection of a very large document).

I'm certain we've already spent more time talking about it than it could ever have saved anyone; sorry that I didn't realize it would attract so much attention.

@zygoloid
Copy link
Member

"Silently do nothing" is at least in principle a problem due to our process of asynchronous pull requests -- there are plenty of merges where no-one looks at the post-merge result and we rely on "build succeeds and check.sh passes" to tell us the document is OK. (Plus there seem to be at least a few edits for motions where there are such obvious visual issues that it's clear the person applying the motion didn't look at the resulting document after application.) I would strongly prefer build errors or check.sh failures for wrong inputs whenever possible.

It would presumably be trivial to check this from check.sh instead if we remain uncomfortable about the macro scope.

@jensmaurer
Copy link
Member

Please, no lone braces.

What's the problem with simply defining the \requires only in the appendix? There is no useful use-case lexically following the appendices.

@tkoeppe
Copy link
Contributor

tkoeppe commented Mar 24, 2020

I agree with Jens. In principle it's of course good to prevent misuse as noisily as possible, but practically, there's basically no potential for harm if the macro is defined before its first use (in Annex D) and then just left alive. I'd keep it simple.

@opensdh
Copy link
Contributor Author

opensdh commented Mar 24, 2020

Please, no lone braces.

Press reload to see no braces.

@zygoloid zygoloid merged commit dfecc29 into cplusplus:master Mar 24, 2020
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

6 participants