LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\))
Content-Type: text/plain; charset=utf-8
Date: Tue, 2 Oct 2018 23:37:58 +0930
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Will Robertson <[log in to unmask]>
Message-ID: <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Transfer-Encoding: quoted-printable
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (21 lines)
Hi Johannes,

> On 2 Oct 2018, at 11:16 pm, Johannes Burtscher <[log in to unmask]> wrote:
> 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?

This is an age-old question for me, and I can’t say I’ve definitively decided. In my own code I think it comes down to scope. If you’re operating on variables that are broader in scope than the auxiliary functions you’re using to process them, I wouldn’t use arguments. 

Of course, using arguments means you can also use expl3’s argument processing (with \cs_generate_variant:Nn etc) which can make it a bit more explicit exactly what your functions should be expecting, but that’s not always necessary or even appropriate in the case of “seq” and other higher-level data types.

In the example you give, I would definitely use arguments:

        \__jfa_func_aux:N \l__jfa_my_seq

This makes it really clear that you’re taking this seq and doing something on it, as opposed to (say) some other aux-related tidying/initialisation or writing to the log file.

Of course this is just my opinion after refactoring my code a few times in both directions :) 

Hope this helps,