"numeric" formatter using undocumented state variables Marc Nieper-Wißkirchen (19 Feb 2019 12:00 UTC)
Re: "numeric" formatter using undocumented state variables Marc Nieper-Wißkirchen (19 Feb 2019 13:26 UTC)
Re: "numeric" formatter using undocumented state variables Marc Nieper-Wißkirchen (20 Feb 2019 16:01 UTC)

Re: "numeric" formatter using undocumented state variables Marc Nieper-Wißkirchen 20 Feb 2019 16:01 UTC

Am Di., 19. Feb. 2019 um 14:26 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@nieper-wisskirchen.de>:
>
> 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

P.P.S.:

(4) The description of the procedure "numeric" says that "decimal-sep"
is a character, while it says under the heading "standard state
variables" that the default for "decimal-sep" is ".", a string.

(5) The behavior coded in this line
https://github.com/ashinn/chibi-scheme/blob/master/lib/chibi/show/write.scm#L266
is not documented in the SRFI.

(6) The reference implementation has some problems with infinite
numbers. For example, the following gives an error: "(show #f (with
((precision 0)) +inf.0))"