[latex3-commits] [git/LaTeX3-latex3-latex3] master: correctly handle __kernel_tl_(g)set:Nx in l3debug (08ddf7e03)

Bruno Le Floch blflatex at gmail.com
Tue Oct 27 09:11:58 CET 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/08ddf7e03ca406beff4760412ae9d9545001493e

>---------------------------------------------------------------

commit 08ddf7e03ca406beff4760412ae9d9545001493e
Author: Jonathan Spratte <jspratte at yahoo.de>
Date:   Sat Sep 19 14:59:22 2020 +0200

    correctly handle __kernel_tl_(g)set:Nx in l3debug


>---------------------------------------------------------------

08ddf7e03ca406beff4760412ae9d9545001493e
 l3kernel/l3candidates.dtx |  6 +++---
 l3kernel/l3debug.dtx      | 21 ++++++++-------------
 l3kernel/l3tl.dtx         | 21 ++++++++++-----------
 3 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 0df1549f6..8ae96314b 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -1438,7 +1438,7 @@
 %   trick to wrap all the \meta{right} parts together.
 %    \begin{macrocode}
 \cs_new_protected:Npn \tl_build_get:NN
-  { \@@_build_get:NNN \tl_set:Nx }
+  { \@@_build_get:NNN \__kernel_tl_set:Nx }
 \cs_new_protected:Npn \@@_build_get:NNN #1#2#3
   { #1 #3 { \if_false: { \fi: \exp_after:wN \@@_build_get:w #2 } } }
 \cs_new:Npn \@@_build_get:w #1 \@@_build_last:NNn #2#3#4
@@ -1463,12 +1463,12 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \tl_build_end:N #1
   {
-    \@@_build_get:NNN \tl_set:Nx #1 #1
+    \@@_build_get:NNN \__kernel_tl_set:Nx #1 #1
     \exp_args:Nc \@@_build_end_loop:NN { \cs_to_str:N #1 ' } \tl_clear:N
   }
 \cs_new_protected:Npn \tl_build_gend:N #1
   {
-    \@@_build_get:NNN \tl_gset:Nx #1 #1
+    \@@_build_get:NNN \__kernel_tl_gset:Nx #1 #1
     \exp_args:Nc \@@_build_end_loop:NN { \cs_to_str:N #1 ' } \tl_gclear:N
   }
 \cs_new_protected:Npn \@@_build_end_loop:NN #1#2
diff --git a/l3kernel/l3debug.dtx b/l3kernel/l3debug.dtx
index 075636895..644b35d8f 100644
--- a/l3kernel/l3debug.dtx
+++ b/l3kernel/l3debug.dtx
@@ -740,13 +740,6 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% Set \cs{__kernel_tl_set:Nx} and \cs{__kernel_tl_gset:Nx} to the same as
-% \cs{tl_set:Nx}.
-%    \begin{macrocode}
-  \cs_gset_protected:Npn \__kernel_tl_set:Nx  { \tl_set:Nx }
-  \cs_gset_protected:Npn \__kernel_tl_gset:Nx { \tl_gset:Nx }
-%    \end{macrocode}
-%
 % Patching the second argument to ensure it exists. This happens before
 % we alter |#1| so the ordering is correct.  For many variable types
 % such as \texttt{int} a low-level error occurs when |#2| is unknown, so
@@ -795,6 +788,12 @@
 % \tracingnone
 %    \end{macrocode}
 %
+%
+%    \begin{macrocode}
+\cs_gset_protected:Npn \__kernel_tl_set:Nx  { \cs_set_nopar:Npx }
+\cs_gset_protected:Npn \__kernel_tl_gset:Nx { \cs_gset_nopar:Npx }
+%    \end{macrocode}
+%
 % Patching where the first argument to a function needs scope-checking:
 % either local or global (so two lists).
 %    \begin{macrocode}
@@ -838,9 +837,7 @@
       \skip_set_eq:NN
       \skip_add:Nn
       \skip_sub:Nn
-      \tl_set:Nn
-      \tl_set:No
-      \tl_set:Nx
+      \__kernel_tl_set:Nx
       \tl_set_eq:NN
       \tl_put_left:Nn
       \tl_put_left:NV
@@ -902,9 +899,7 @@
       \skip_gset_eq:NN
       \skip_gadd:Nn
       \skip_gsub:Nn
-      \tl_gset:Nn
-      \tl_gset:No
-      \tl_gset:Nx
+      \__kernel_tl_gset:Nx
       \tl_gset_eq:NN
       \tl_gput_left:Nn
       \tl_gput_left:NV
diff --git a/l3kernel/l3tl.dtx b/l3kernel/l3tl.dtx
index d8a7adf8e..45fffc6ca 100644
--- a/l3kernel/l3tl.dtx
+++ b/l3kernel/l3tl.dtx
@@ -1271,10 +1271,7 @@
 %
 % \begin{macro}{\__kernel_tl_set:Nx,\__kernel_tl_gset:Nx}
 %   These two are supplied to get better performance for macros which would
-%   otherwise use \cs{tl_set:Nx} or \cs{tl_gset:Nx} internally. Not every macro
-%   in this module uses \cs{__kernel_tl_set:Nx} or \cs{__kernel_tl_gset:Nx}
-%   instead of \cs{cs_set_nopar:cpx} or \cs{cs_gset_nopar:Npx} to avoid circular
-%   definitions if \pkg{l3debug} is used.
+%   otherwise use \cs{tl_set:Nx} or \cs{tl_gset:Nx} internally.
 %    \begin{macrocode}
 \cs_new_eq:NN \__kernel_tl_set:Nx \cs_set_nopar:Npx
 \cs_new_eq:NN \__kernel_tl_gset:Nx \cs_gset_nopar:Npx
@@ -1295,7 +1292,9 @@
 % \end{macro}
 %
 % \begin{macro}{\tl_const:Nn, \tl_const:Nx, \tl_const:cn, \tl_const:cx}
-%   Constants are also easy to generate.
+%   Constants are also easy to generate. They use \cs{cs_gset_nopar:Npx} instead
+%   of \cs{__kernel_tl_gset:Nx} so that the correct scope checking is applied if
+%   \pkg{l3debug} is used.
 %    \begin{macrocode}
 \cs_new_protected:Npn \tl_const:Nn #1#2
   {
@@ -1443,17 +1442,17 @@
 %   \enquote{by hand} as it is used quite a lot.
 %    \begin{macrocode}
 \cs_new_protected:Npn \tl_set:Nn #1#2
-  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w {#2} } }
 \cs_new_protected:Npn \tl_set:No #1#2
-  { \cs_set_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
+  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
 \cs_new_protected:Npn \tl_set:Nx #1#2
-  { \cs_set_nopar:Npx #1 {#2} }
+  { \__kernel_tl_set:Nx #1 {#2} }
 \cs_new_protected:Npn \tl_gset:Nn #1#2
-  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} } }
+  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w {#2} } }
 \cs_new_protected:Npn \tl_gset:No #1#2
-  { \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
+  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
 \cs_new_protected:Npn \tl_gset:Nx #1#2
-  { \cs_gset_nopar:Npx #1 {#2} }
+  { \__kernel_tl_gset:Nx #1 {#2} }
 \cs_generate_variant:Nn \tl_set:Nn  {         NV , Nv , Nf }
 \cs_generate_variant:Nn \tl_set:Nx  { c }
 \cs_generate_variant:Nn \tl_set:Nn  { c, co , cV , cv , cf }





More information about the latex3-commits mailing list.