LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text 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:
Will Robertson <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 2 Oct 2018 23:37:58 +0930
Content-Type:
text/plain
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,
Will

ATOM RSS1 RSS2