unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#50068: Curried definitions lose docstrings
@ 2021-08-15 10:13 Jean Abou Samra
  0 siblings, 0 replies; only message in thread
From: Jean Abou Samra @ 2021-08-15 10:13 UTC (permalink / raw)
  To: 50068

When a docstring is used in the body of a curried definition,
it ends up on the result of the application of the resulting
curried function, not on the function itself. Example:

(use-modules (ice-9 curried-definitions))

(define ((curried a) b)
   "Docstring of curried"
   'whatever)

(procedure-documentation curried)
=> #f

(procedure-documentation (curried 'whatnot))
=> "Docstring of curried"


This is apparently because Guile translates

(define ((curried a) b)
   ...)

to

(define (curried a)
   (lambda (b)
     ...))

which puts the docstring in the body
of lambda.

Tested with Guile 2.2 and 3.0.5.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-15 10:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-15 10:13 bug#50068: Curried definitions lose docstrings Jean Abou Samra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).