Re: "numeric" formatter using undocumented state variables
Marc Nieper-WiÃkirchen 19 Feb 2019 13:26 UTC
Am Di., 19. Feb. 2019 um 13:00 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@nieper-wisskirchen.de>:
>
> (1) The reference implementation uses a number of state variables that
> are not documented, for example, "sign-rule", "comma-rule", and
> "comma-sep". If user code uses state variables with the same symbolic
> name, the reference implementation may break.
>
> The tests assume that particular implementation detail.
>
> Note that the SRFI says (under the description of "numeric"): "These
> parameters may seem unwieldy, but they can also take their defaults
> from state variables, described below." This could mean that state
> variables with the names "sign" and "comma" should be provided but the
> reference implementation does not use state variables of these names.
>
> To solve this issue, either the yet undocumented state variables have
> to be documented or the reference implementation has to be changed
> (easy as soon as we have hygienic state variables).
>
> (2) In the numeric formatter, there is no way to specify, say, the
> "comma-sep" parameter without specifying the "sign" parameter.
> However, it is not documented which value is to be used for "sign" if
> one wants the default (a minus sign for negative values and no sign
> for positive values).
>
> The tests rely on the reference implementation accepting the value "#f".
P.S.:
(3) The documentation of SRFI 159 states that the "sign" argument of
"numeric" can either be "#t" or a pair of two strings. The reference
implementation does not implement that latter case but implements
something different:
https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/show/write.scm#L294