-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Optimise creation of document commands with m-type args #1190
Conversation
No roll-back - I don't think we need it here |
Not sure if we want to keep the one-step indirection? That would still mark these as ' |
I'd rather keep that, because then for other systems like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks basically fine to me (assuming that it doesn't break any of the \ShowCommand.. \CopyCommand... thingies, but I can't see how nd the suite should tell us.
So other than perhaps a bit more words in ltnews and also in usrguide I guess (stating that one can use \NewExpanableDocumentCommand instead of \newcommand for consistency and get the same "speed" or something like that) it looks fine
I was wondering about that, but what do you gain from ltcmdhooks know that it was done on top-level with |
Not :-) When the code knows that the command |
ok point taken but it should be a really light indirections that is basically a single extra expansion |
All doable. I am then wondering about \cs_new_protected:Npn \@@_cmd_type_cases:NnnnnF #1 #2 #3 #4 #5 #6
{
\exp_args:Ne \str_case_e:nnF
{
\exp_args:Nf \tl_if_empty:nT { \cs_argument_spec:N #1 }
{ \exp_not:N \exp_not:n { \exp_not:e { \tl_head:N #1 } } }
}
{
{ \exp_not:N \@@_start:nNNnnn } {#2}
{ \exp_not:N \@@_start_expandable:nNNNNn } {#3}
{ \exp_not:N \@@_start_env:nnnnn } {#4}
{
\exp_after:wN \exp_not:N
\cs:w environment~
\exp_last_unbraced:Ne \use_none:nnn
{ \cs_to_str:N #1 } ~end~aux \cs_end:
} {#5}
}
{#6}
} rather than simply check if |
Also similar in |
That's a bit more tricky due to |
I've added one level of indirection. Note that this means that an error shows |
We might need to test for end-of-env, but all of the others have |
OK, I see that for copying there are different paths (so we will need to extend), but does this need to share the code with the yes/no test? |
I need to adjust to skip optimisation for envs: currently doing that gives some very odd situation with building |
The problem in this case is if someone does |
why not simply |
That had also occurred to me: I was initially aiming for a simple structure, but a flag might serve as well as anything else. |
Not to be confused with an l3 flag:-). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ltnews adjustments for reintroduced redirection and possibility to optimise +m
-arg only cases.
Promoting |
Agreed, but in this case |
Just |
More or less what I've done. |
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
Co-authored-by: Yukai Chou <muzimuzhi@gmail.com>
I just find what I was looking for yesterday: Now If that's the decision, this trade off may need some words in documentation. |
I missed that, where are they dropped? |
@FrankMittelbach I worried too much. Optimized commands need neither |
@muzimuzhi it has the potential to change behaviour (check with the current behaviour):
|
That’s protected status , which is unchanged |
The same behaviour change would occur with |
I think a comment on that difference next to the code definition might be sensible, but I wouldn't go further and document it on the level of the user documentation because being able able to grab and destroy a |
Done |
READ ME FIRST: Please understand that in most cases we will not be able to merge a pull request because there are a lot of internal activities needed when updating the LaTeX2e sources. If you have a code suggestion please discuss it with the team first.
Pull requests in this repository are intended for LaTeX Team members only.
Internal housekeeping
Status of pull request
Checklist of required changes before merge will be approved
\changes
entries in source includedchanges.txt
updatedltnewsX.tex
(and/orlatexchanges.tex
) updated