How to debug “Inconsistent local/global assignment” in l3seq (expl3)?hyperref incorrect links: how to...

Were there two appearances of Stan Lee?

What is the difference between `a[bc]d` (brackets) and `a{b,c}d` (braces)?

What was the "glowing package" Pym was expecting?

Examples of non trivial equivalence relations , I mean equivalence relations without the expression " same ... as" in their definition?

Normal subgroup of even order whose nontrivial elements form a single conjugacy class is abelian

Why is current rating for multicore cable lower than single core with the same cross section?

Packing rectangles: Does rotation ever help?

Sci-fi novel series with instant travel between planets through gates. A river runs through the gates

How to determine the actual or "true" resolution of a digital photograph?

What's the polite way to say "I need to urinate"?

When India mathematicians did know Euclid's Elements?

Can my Warlock be invisible and attack with its familiar?

How to set the font color of quantity objects (Version 11.3 vs version 12)?

get exit status from system() call

What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?

A non-technological, repeating, visible object in the sky, holding its position in the sky for hours

Reverse the word in a string with the same order in javascript

Are Boeing 737-800’s grounded?

Illegal assignment from SObject to Contact

Can fracking help reduce CO2?

Confusion about capacitors

How to creep the reader out with what seems like a normal person?

You look catfish vs You look like a catfish

Upright [...] in italics quotation



How to debug “Inconsistent local/global assignment” in l3seq (expl3)?


hyperref incorrect links: how to debug?How do I register the prefix of my expl3 package?How to use a local variable inside a macro in expl3How is expl3 typed?Labelling confusion in expl3: (public, private) Vs (global, local)How to obtain enough debug information?How are charcodes categorized in LaTeX3/expl3?When should one use a local or global variable in LaTeX?How to modify a single item in l3seq/l3clistHow to expand a macro (or a copy) to save in a list at end of environment in xparse (expl3)?













0















I'm trying to debug an expl3 code that usesl3seq and seq_gput_right. By adding the enable-debug and reviewing the code I get the error:



! LaTeX3 Error: Inconsistent local / global assignment


That was previously hidden (but worked fine). The error comes from the line seq_gput_right:cn, but if I change it to seq_put_right:cn the error disappears but the code does not work as it should.



The example file is the following, I have occupied it a lot of times and I had not noticed the error.



documentclass{article}
RequirePackage[enable-debug]{expl3}
usepackage{xparse}
ExplSyntaxOn
debug_on:n{check-declarations,deprecation,check-expressions}
% internal
NewDocumentCommand{_appendcontents}{ m +m }
{
mymodule_append_contents:nn { #1 } {{ #2 }}
}
% external
NewExpandableDocumentCommand{usecontents}{O{1}m}
{
mymodule_use_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn mymodule_append_contents:nn #1 #2
{
seq_if_exist:cF { l_mymodule_contents_#1_seq }
{ seq_new:c { l_mymodule_contents_#1_seq } }
__mymodule_append_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn __mymodule_append_contents:nn #1 #2
{
tl_map_inline:nn { #2 }
{
%seq_put_right:cn { l_mymodule_contents_#1_seq } { ##1 }
seq_gput_right:cn { l_mymodule_contents_#1_seq } { ##1 }
}
}

cs_new:Npn mymodule_use_contents:nn #1 #2
{
seq_item:cn { l_mymodule_contents_#2_seq } { #1 }
}

% [key=val]
keys_define:nn { mymodule }
{
save-cmd .tl_set:N = l_mymodule_cmd_save_tl,
save-cmd .initial:n = contents,
show-cmd .bool_set:N = l_mymodule_cmd_show_tl,
show-cmd .initial:n = false,
}

% Scontents[...]{...}
NewDocumentCommand{Scontents}{ o +m }
{
group_begin:
IfNoValueF { #1 } { keys_set:nn { mymodule } { #1 } }
_appendcontents{l_mymodule_cmd_save_tl}{ #2 } % add to list
IfBooleanT { l_mymodule_cmd_show_tl } { usecontents[-1]{ l_mymodule_cmd_save_tl} }
group_end:
}
ExplSyntaxOff

begin{document}
section{Default list}
Use command par
Scontents{saved in list {contents} index 1}par
Scontents{saved in list {contents} index 2}
Show savedpar
usecontents[2]{contents}par
usecontents[1]{contents}

section{Custom list}
Use command par
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 1}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 2}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 3}
Show saved in list {test-cmd}par
usecontents[3]{test-cmd}par
usecontents[1]{test-cmd}par
usecontents[2]{test-cmd}par
Add one more to list {contents}par
Scontents{saved in list {contents} index 3}
Show saved in list {contents}par
usecontents[3]{contents}par
usecontents[2]{contents}par
usecontents[1]{contents}
end{document}


How do I fix this?



Saludos










share|improve this question




















  • 1





    Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

    – egreg
    59 mins ago











  • OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

    – Pablo González L
    42 mins ago













  • If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

    – egreg
    41 mins ago











  • @egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

    – Pablo González L
    34 mins ago











  • If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

    – egreg
    23 mins ago
















0















I'm trying to debug an expl3 code that usesl3seq and seq_gput_right. By adding the enable-debug and reviewing the code I get the error:



! LaTeX3 Error: Inconsistent local / global assignment


That was previously hidden (but worked fine). The error comes from the line seq_gput_right:cn, but if I change it to seq_put_right:cn the error disappears but the code does not work as it should.



The example file is the following, I have occupied it a lot of times and I had not noticed the error.



documentclass{article}
RequirePackage[enable-debug]{expl3}
usepackage{xparse}
ExplSyntaxOn
debug_on:n{check-declarations,deprecation,check-expressions}
% internal
NewDocumentCommand{_appendcontents}{ m +m }
{
mymodule_append_contents:nn { #1 } {{ #2 }}
}
% external
NewExpandableDocumentCommand{usecontents}{O{1}m}
{
mymodule_use_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn mymodule_append_contents:nn #1 #2
{
seq_if_exist:cF { l_mymodule_contents_#1_seq }
{ seq_new:c { l_mymodule_contents_#1_seq } }
__mymodule_append_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn __mymodule_append_contents:nn #1 #2
{
tl_map_inline:nn { #2 }
{
%seq_put_right:cn { l_mymodule_contents_#1_seq } { ##1 }
seq_gput_right:cn { l_mymodule_contents_#1_seq } { ##1 }
}
}

cs_new:Npn mymodule_use_contents:nn #1 #2
{
seq_item:cn { l_mymodule_contents_#2_seq } { #1 }
}

% [key=val]
keys_define:nn { mymodule }
{
save-cmd .tl_set:N = l_mymodule_cmd_save_tl,
save-cmd .initial:n = contents,
show-cmd .bool_set:N = l_mymodule_cmd_show_tl,
show-cmd .initial:n = false,
}

% Scontents[...]{...}
NewDocumentCommand{Scontents}{ o +m }
{
group_begin:
IfNoValueF { #1 } { keys_set:nn { mymodule } { #1 } }
_appendcontents{l_mymodule_cmd_save_tl}{ #2 } % add to list
IfBooleanT { l_mymodule_cmd_show_tl } { usecontents[-1]{ l_mymodule_cmd_save_tl} }
group_end:
}
ExplSyntaxOff

begin{document}
section{Default list}
Use command par
Scontents{saved in list {contents} index 1}par
Scontents{saved in list {contents} index 2}
Show savedpar
usecontents[2]{contents}par
usecontents[1]{contents}

section{Custom list}
Use command par
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 1}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 2}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 3}
Show saved in list {test-cmd}par
usecontents[3]{test-cmd}par
usecontents[1]{test-cmd}par
usecontents[2]{test-cmd}par
Add one more to list {contents}par
Scontents{saved in list {contents} index 3}
Show saved in list {contents}par
usecontents[3]{contents}par
usecontents[2]{contents}par
usecontents[1]{contents}
end{document}


How do I fix this?



Saludos










share|improve this question




















  • 1





    Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

    – egreg
    59 mins ago











  • OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

    – Pablo González L
    42 mins ago













  • If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

    – egreg
    41 mins ago











  • @egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

    – Pablo González L
    34 mins ago











  • If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

    – egreg
    23 mins ago














0












0








0








I'm trying to debug an expl3 code that usesl3seq and seq_gput_right. By adding the enable-debug and reviewing the code I get the error:



! LaTeX3 Error: Inconsistent local / global assignment


That was previously hidden (but worked fine). The error comes from the line seq_gput_right:cn, but if I change it to seq_put_right:cn the error disappears but the code does not work as it should.



The example file is the following, I have occupied it a lot of times and I had not noticed the error.



documentclass{article}
RequirePackage[enable-debug]{expl3}
usepackage{xparse}
ExplSyntaxOn
debug_on:n{check-declarations,deprecation,check-expressions}
% internal
NewDocumentCommand{_appendcontents}{ m +m }
{
mymodule_append_contents:nn { #1 } {{ #2 }}
}
% external
NewExpandableDocumentCommand{usecontents}{O{1}m}
{
mymodule_use_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn mymodule_append_contents:nn #1 #2
{
seq_if_exist:cF { l_mymodule_contents_#1_seq }
{ seq_new:c { l_mymodule_contents_#1_seq } }
__mymodule_append_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn __mymodule_append_contents:nn #1 #2
{
tl_map_inline:nn { #2 }
{
%seq_put_right:cn { l_mymodule_contents_#1_seq } { ##1 }
seq_gput_right:cn { l_mymodule_contents_#1_seq } { ##1 }
}
}

cs_new:Npn mymodule_use_contents:nn #1 #2
{
seq_item:cn { l_mymodule_contents_#2_seq } { #1 }
}

% [key=val]
keys_define:nn { mymodule }
{
save-cmd .tl_set:N = l_mymodule_cmd_save_tl,
save-cmd .initial:n = contents,
show-cmd .bool_set:N = l_mymodule_cmd_show_tl,
show-cmd .initial:n = false,
}

% Scontents[...]{...}
NewDocumentCommand{Scontents}{ o +m }
{
group_begin:
IfNoValueF { #1 } { keys_set:nn { mymodule } { #1 } }
_appendcontents{l_mymodule_cmd_save_tl}{ #2 } % add to list
IfBooleanT { l_mymodule_cmd_show_tl } { usecontents[-1]{ l_mymodule_cmd_save_tl} }
group_end:
}
ExplSyntaxOff

begin{document}
section{Default list}
Use command par
Scontents{saved in list {contents} index 1}par
Scontents{saved in list {contents} index 2}
Show savedpar
usecontents[2]{contents}par
usecontents[1]{contents}

section{Custom list}
Use command par
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 1}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 2}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 3}
Show saved in list {test-cmd}par
usecontents[3]{test-cmd}par
usecontents[1]{test-cmd}par
usecontents[2]{test-cmd}par
Add one more to list {contents}par
Scontents{saved in list {contents} index 3}
Show saved in list {contents}par
usecontents[3]{contents}par
usecontents[2]{contents}par
usecontents[1]{contents}
end{document}


How do I fix this?



Saludos










share|improve this question
















I'm trying to debug an expl3 code that usesl3seq and seq_gput_right. By adding the enable-debug and reviewing the code I get the error:



! LaTeX3 Error: Inconsistent local / global assignment


That was previously hidden (but worked fine). The error comes from the line seq_gput_right:cn, but if I change it to seq_put_right:cn the error disappears but the code does not work as it should.



The example file is the following, I have occupied it a lot of times and I had not noticed the error.



documentclass{article}
RequirePackage[enable-debug]{expl3}
usepackage{xparse}
ExplSyntaxOn
debug_on:n{check-declarations,deprecation,check-expressions}
% internal
NewDocumentCommand{_appendcontents}{ m +m }
{
mymodule_append_contents:nn { #1 } {{ #2 }}
}
% external
NewExpandableDocumentCommand{usecontents}{O{1}m}
{
mymodule_use_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn mymodule_append_contents:nn #1 #2
{
seq_if_exist:cF { l_mymodule_contents_#1_seq }
{ seq_new:c { l_mymodule_contents_#1_seq } }
__mymodule_append_contents:nn { #1 } { #2 }
}

cs_new_protected:Npn __mymodule_append_contents:nn #1 #2
{
tl_map_inline:nn { #2 }
{
%seq_put_right:cn { l_mymodule_contents_#1_seq } { ##1 }
seq_gput_right:cn { l_mymodule_contents_#1_seq } { ##1 }
}
}

cs_new:Npn mymodule_use_contents:nn #1 #2
{
seq_item:cn { l_mymodule_contents_#2_seq } { #1 }
}

% [key=val]
keys_define:nn { mymodule }
{
save-cmd .tl_set:N = l_mymodule_cmd_save_tl,
save-cmd .initial:n = contents,
show-cmd .bool_set:N = l_mymodule_cmd_show_tl,
show-cmd .initial:n = false,
}

% Scontents[...]{...}
NewDocumentCommand{Scontents}{ o +m }
{
group_begin:
IfNoValueF { #1 } { keys_set:nn { mymodule } { #1 } }
_appendcontents{l_mymodule_cmd_save_tl}{ #2 } % add to list
IfBooleanT { l_mymodule_cmd_show_tl } { usecontents[-1]{ l_mymodule_cmd_save_tl} }
group_end:
}
ExplSyntaxOff

begin{document}
section{Default list}
Use command par
Scontents{saved in list {contents} index 1}par
Scontents{saved in list {contents} index 2}
Show savedpar
usecontents[2]{contents}par
usecontents[1]{contents}

section{Custom list}
Use command par
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 1}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 2}
Scontents[save-cmd=test-cmd]{saved in list {test-cmd} index 3}
Show saved in list {test-cmd}par
usecontents[3]{test-cmd}par
usecontents[1]{test-cmd}par
usecontents[2]{test-cmd}par
Add one more to list {contents}par
Scontents{saved in list {contents} index 3}
Show saved in list {contents}par
usecontents[3]{contents}par
usecontents[2]{contents}par
usecontents[1]{contents}
end{document}


How do I fix this?



Saludos







expl3 latex3 debugging






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 48 mins ago







Pablo González L

















asked 1 hour ago









Pablo González LPablo González L

1,0631921




1,0631921








  • 1





    Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

    – egreg
    59 mins ago











  • OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

    – Pablo González L
    42 mins ago













  • If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

    – egreg
    41 mins ago











  • @egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

    – Pablo González L
    34 mins ago











  • If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

    – egreg
    23 mins ago














  • 1





    Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

    – egreg
    59 mins ago











  • OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

    – Pablo González L
    42 mins ago













  • If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

    – egreg
    41 mins ago











  • @egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

    – Pablo González L
    34 mins ago











  • If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

    – egreg
    23 mins ago








1




1





Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

– egreg
59 mins ago





Don't use seq_gput_right:Nn with a local variable (name beginning with l_). Global assignments must be done on global variables (name beginning with g_). By the way, it's quite strange to define a user command with _ in its name (like _appendcontents).

– egreg
59 mins ago













OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

– Pablo González L
42 mins ago







OK, I understand about the use of l_ and g_, _appendcontents is an internal command, the user command is Scontents ( _appendcontents need double {{}}). The issue of changing the locale variables by global to disappear already cracked lists, edit the sample file a bit.

– Pablo González L
42 mins ago















If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

– egreg
41 mins ago





If it is an internal command, it should have its regular prefix and be defined with cs_new_protected:Npn

– egreg
41 mins ago













@egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

– Pablo González L
34 mins ago





@egreg My attempts in that aspect have failed, I lose the lists already created, could you show me an example?

– Pablo González L
34 mins ago













If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

– egreg
23 mins ago





If I do Scontents{Hello world}, the sequence will contain ten items {H}{e}{l}{l}{o}{W}{o}{r}{l}{d}. Is that what you really want?

– egreg
23 mins ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488138%2fhow-to-debug-inconsistent-local-global-assignment-in-l3seq-expl3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488138%2fhow-to-debug-inconsistent-local-global-assignment-in-l3seq-expl3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown