LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Johannes Burtscher <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 2 Oct 2018 15:46:10 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (20 lines)
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

ATOM RSS1 RSS2