[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructed docstrings for closures
From: |
David Kastrup |
Subject: |
Re: Constructed docstrings for closures |
Date: |
Fri, 16 Jan 2015 17:46:19 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
> When converting backquoted lambdas to closures, I've often bumped into
> the following problem:
>
> `(lambda (foo bar)
> ,(concat "Toto is very " blabla ".")
> (code using foo and bar (and ',blabla as well)))
>
> So code-wise, this can be replaced by a closure just fine, but doc-wise
> we don't have a way to construct a different docstring for
> every closure.
>
> I'd like to lift this restriction by offering a new feature that lets us
> do something like:
>
> (lambda (foo bar)
> <something-magical-here>
> (code using foo and bar (and blabla as well)))
>
> and get the closure we want with the docstring we want.
>
> Does anyone have an idea of what the <something-magical-here>
> could/should be?
Doing it the other way round seems much cleaner:
(with-doc-string
(concat "Toto is very " blabla ".")
(lambda (foo bar)
(code using foo and bar (and blabla as well))))
--
David Kastrup