emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constructed docstrings for closures


From: Artur Malabarba
Subject: Re: Constructed docstrings for closures
Date: Fri, 16 Jan 2015 21:07:35 -0200

> Lars suggests:
> > (declare (comment (format "This is a comment about %s" bla)))
> > would be a natural syntax, I think?
I agree this would be the most natural, but if it does slow down
evaluation (which I think it would), then it isn't worth the cost.
OTOH, it might be interesting to apply this logic to `defun's, since
they already handle `declare' forms anyway.

> 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))))

If this is chosen, I would find the following form more natural:

(lambda-with-doc-string (foo bar)
  ;; First body form is evaluated at compile time and must return a string.
  (concat "Toto is very " blabla ".")
  ;; Everything else is a regular lambda.
  (code using foo and bar (and blabla as well)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]