GNU bug report logs -
#25461
Missing doc strings for "," and ",@".
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Mon, 16 Jan 2017 21:24:01 UTC
Severity: wishlist
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello, Michael.
On Thu, Jan 19, 2017 at 03:23:32AM +0100, Michael Heerdegen wrote:
> Hi Alan,
> > diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
> > index 94c561c..86ca010 100644
> > --- a/lisp/emacs-lisp/backquote.el
> > +++ b/lisp/emacs-lisp/backquote.el
> > @@ -247,4 +247,33 @@ backquote-listify
> > tail))
> > (t (cons 'list heads)))))
> > +
> > +;; Give `,' and `,@' documentation strings which can be examined by C-h f.
> > +(put '\, 'function-documentation
> > + "`,' signals that the next form should be evaluated and inserted.
> > +It can occur only in `\\=`' constructs.
> > +
> > +For example:
> > +
> > +b => (ba bb bc) ; assume b has this value
> > +\\=`(a ,b c) => (a (ba bb bc) c) ; insert the value of b
> > +
> > +See also `\\=`' and `,@'.
> I don't think this makes it easier for people to understand things.
> This suggests that "," has some kind of meaning per se, that it is a
> macro-like thing, etc, and that pcase somehow redefines it.
Yes. All these things are true, aren't they?
> Of course there is a logic behind pcase's usage of ` and ,. The
> usage of these suggests a mental model for their "meaning". But we
> should not describe our mental models in docstrings. That's only useful
> for people sharing the same model.
I'm not sure I'm following you here. A high level description of a
function necessarily involves a mental model.
> The bindings of variables depend on context. The semantics of functions
> are fluent (advice, local functions). And also the "meaning" of the
> sexps created by ` and , depend on the context - in Lisp, the "meaning"
> of all sexps depends on context. (foo bar) can be a function call or a
> part of a let variable binding or a list or a pcase pattern. It's not
> different for sexps involving `.
` has a specific meaning, and has had a high quality doc string for
ever. , likewise has a specific meaning, but doesn't yet have a doc
string.
In Emacs Lisp, functions generally have well defined context-free
semantics, though there are exceptions.
> So I think we maximally should describe what the reader does with `
> etc., so that people know what to search for in the manual or remember
> what they already had learned.
We don't do that for other functions. A function's doc string should be
a crisp summary of what a function _does_. A doc string which directs
people to a manual, or is so confusing or unspecific that the reader is
forced to open a manual, is a failed doc string.
, has a definite precise function (disregarding its use in pcase for
now). Have you any specific suggestions on how to improve my wording of
its doc string?
> + ((get function 'reader-macro)
> + "a reader macro")
> We don't have reader macros in Emacs.
The reader performs macro-like actions. What is the correct alternative
term for what the reader does with ', `, ,, #', etc.?
> If we had them, we could implement ', ` etc. as reader macros. But
> using this term in H-f is confusing, because it is not used in the
> manual.
What would be a less confusing alternative?
> Regards,
> Michael
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 8 years and 116 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.