‘generate-documentation’ shows evaluated default values

  • Open
  • quality assurance status badge
Details
One participant
  • Ludovic Courtès
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 20 Jul 2023 12:58
(address . bug-guix@gnu.org)
875y6eetob.fsf@inria.fr
The ‘generate-documentation’ procedure of (gnu services configuration)
shows evaluated default values, as in this example:

Toggle snippet (24 lines)
scheme@(gnu services admin)> (define serialize-string identity)
scheme@(gnu services admin)> (define-configuration foo
(f (string (version)) "The version string."))
scheme@(gnu services admin)> (foo)
$44 = #<<foo> f: "3.0.99-git" %location: #f>
scheme@(gnu services admin)> (display (generate-documentation `((foo ,foo-fields)) 'foo))

@c %start of fragment

@deftp {Data Type} foo
Available @code{foo} fields are:

@table @asis
@item @code{f} (default: @code{"3.0.99-git"}) (type: string)
The version string.

@end table

@end deftp


@c %end of fragment

Notice that the ‘version’ call is expanded.

This is problematic because sometimes we explicitly want to have default
values like ‘%default-xyz’ or ‘(expt 2 10)’, and this is what we want
to appear in the manual, not their evaluation result.

Ludo’.
?