Hi all,

since TeX is actually a macro processor, I find it somewhat difficult to convert concepts from other languages to it. Currently I'm wondering about the following: let's say I have a function that takes some input, processes it and then hands the results off to some auxiliary functions. These functions exist solely to keep things reasonably organized and are never called by any other function. The question now is: should these auxiliary functions take their input as actual arguments or should they simply rely on the variables set up by the caller?

    \seq_new:N \l__jfa_my_seq
    \cs_new_protected:Nn \__jfa_func:n
      {
        \seq_set_split:Nnn \l__jfa_my_seq {/} {#1}
        \__jfa_func_aux:N \l__jfa_my_seq
        \__jfa_func_aux:
      }
    \cs_new_protected:Nn \__jfa_func_aux:N
      { \seq_show:N #1 }
    \cs_new_protected:Nn \__jfa_func_aux:
      { \seq_show:N \l__jfa_my_seq }

In any other language I would clearly opt for the explicit argument just to avoid global variables but with TeX's scoping rules the situation seems to be fundamentally different. I (think I) know that it doesn't make any difference after all, but I would still like to know if one variant is preferred over the other and, if so, why.

Best
Johannes