printtyp: enforce calls to wrap_printing_env

Created by: Octachron

This PR is the heavy-handed sibling of #1975: it enforces the use of Printtyp.wrap_printing_env before any call to Printtyp functions that rely on the printing environment by hiding those functions in the interface file and only giving them back after a call to Printtyp.wrap_printing_env.

If the first-class module approach is too heavy, I can see two alternatives. I could either use an abstract token to unlock function by function rather than a first-class module (the initial version of this PR was made to quickly check that #1975 covered all paths ) . Or, I could alter the printtyp functions to handle more gracefully failures to set the printing env. In particular, we could make sure to avoid any environment lookups in this case; and still integrate the missing calls to Printtyp.wrap_printing_env unearthed in #1975 and this PR.

Merge request reports

Loading