[m-rev.] for review: pretty-printing sparse bitsets
Julien Fischer
jfischer at opturion.com
Tue Sep 23 10:00:00 AEST 2025
On Mon, 22 Sept 2025 at 20:22, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> On Mon, 22 Sep 2025 19:48:11 +1000, Julien Fischer <jfischer at opturion.com> wrote:
>
> > On Mon, 22 Sept 2025 at 18:51, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> >
> > > But in the process, I found that the last part of the comment says that
> > > the default formatter map is thread local. For at least the C backend,
> > > I don't see that being true, since we store the map in a global variable.
> > > Do you know the story behind that?
> >
> > The default formatter map was originally stored in a thread-local mutable,
> > so the documentation was accurate when this module was written.
> > Ralph changed that in commit ceb64e8c in an attempt to avoid module
> > ordering problems when using :- initialise directives to populate the default
> > formatter map. (I suspect the removal of the thread-local aspect may have
> > been inadvertent.)
>
> But after commit 5cbcfaa0edfc1b784ce4e33cdef29b3ac7a6392e,
> which moved the type-specific format operations to pretty_printer.m itself,
> that ordering problem should have disappeared wrt the standard library,
> though it may remain wrt user-written modules.
In which case, the problem remains.
> On the other hand, I don't use multi-thread code myself, so I don't know
> what use cases there are for thread-specific formatter maps. I really can't
> think of any, given that put_doc allows any call that needs a specific formatter
> map to specify that map itself.
I certainly don't use thread-specific formatter maps; in fact, I'm struggling
to think of when I last used this pretty-printer.
> My question is: should we fix the code to make the default formatter map
> thread-local, or should we delete the false claim that it *is* thread-local? I don't
> really care one way or the other, but I think the contradiction should be resolved.
Given that it has been non-thread-local for 15 years now and nobody
has complained,
I suggest just updating the documentation.
Julien.
More information about the reviews
mailing list