unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jean Abou Samra <jean@abou-samra.fr>
To: 50068@debbugs.gnu.org
Subject: bug#50068: Curried definitions lose docstrings
Date: Sun, 15 Aug 2021 12:13:28 +0200	[thread overview]
Message-ID: <531f2e17-3f13-4610-5238-17ff94a2b3fd@abou-samra.fr> (raw)

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.





             reply	other threads:[~2021-08-15 10:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 10:13 Jean Abou Samra [this message]
2022-03-28 23:25 ` bug#50068: [PATCH] In curried definitions, move docstrings to outermost lambda Jean Abou Samra
2022-08-26 11:00 ` bug#50068: [PATCH] In curried definitions, move docstrings to outermost lambdas Jean Abou Samra
2022-08-29 16:10   ` lloda
2022-08-29 16:15     ` Jean Abou Samra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531f2e17-3f13-4610-5238-17ff94a2b3fd@abou-samra.fr \
    --to=jean@abou-samra.fr \
    --cc=50068@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).