Re: Using parameters for customization
Sergei Egorov 06 Jul 2026 21:15 UTC
> On Thursday, July 2, 2026 5:39:53 PM (-04:00), Peter McGoron wrote:
> > On 5/15/26 09:31, Sergei Egorov wrote:
> > > I probably need to clarify it: only one of the libraries exporting
'pp' should be imported,
> > > they are not supposed to complement each other in the same program.
> I think this is an issue for using this SRFI in libraries. One would
have to keep consistent
> which pretty-print library recursively across all imported libraries.
It is an issue only if implementors decide to code the libraries
separately.
As suggested in the prelude, all supported libraries other than the most
capable one may simply re-export parts of its functionality, sharing common
code that is imported only once. It is up to implementors to weigh this
concern against all other practical considerations facing their
implementations.
> I think a single parameter object that contains the complete
customization
> state is better and easier to reason about.
It is one of the popular methods for dealing with multiple parameters,
and users who prefer it may limit themselves to using pp* and parameter
lists
covering the entire set of parameters; the fact that the customization
state
is a list just makes it easier to work with. Doing it this way makes the
printer's
behavior completely insensitive to the values of the global parameters.
> As an aside, I think the variable-argument `pp` and `pp*` should be
> moved up to the `basic` library, since that library has parameters that
> can be passed to them as keywords.
OK, makes sense, I will consider this.
> Also, `pp*` should take an association list instead of the apply-list
> as its final argument. Currently the procedure is equivalent to `apply`.
> A user is more likely to store a map from keywords to objects in an
association list.
It would make sense if I wanted to make the configuration object the
only way to guide the pretty printer's behavior; taking into consideration
that
not all users prefer it (judging by what existing pretty printers support),
I believe that a flat alternating list is better exactly because it has the
form expected by 'apply'.
-S