[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Constructed docstrings for closures
From: |
Stefan Monnier |
Subject: |
Re: Constructed docstrings for closures |
Date: |
Fri, 16 Jan 2015 15:54:24 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Lars suggests:
> (declare (comment (format "This is a comment about %s" bla)))
> would be a natural syntax, I think?
David prefers:
> 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))))
There are various issues around this:
1- the code that constructs the docstring should be visible to the compiler
(so the compiler can tell it where to find the value of the lexically
scoped `blabla' variable).
2- it shouldn't slow down normal evaluation
3- it should be implementable without too much effort.
>From that point of view I guess David's approach is promising on
the first two points, but I'm not sure what the 3rd point would
look like.
Lars's suggestion seems problematic w.r.t point #2 since `lambda' would
now have to check for a `declare'.
I considered using a special property on the docstring as well, but
that's problematic w.r.t point #1.
So please keep sending ideas.
Stefan