From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#25461: [Patch]: Missing doc strings for "," and ",@". Date: Fri, 20 Jan 2017 16:58:56 +0000 Message-ID: <20170120165856.GA3384@acm.fritz.box> References: <20170116212257.GA4747@acm.fritz.box> <20170118194320.GB4108@acm.fritz.box> <87lgu7dbyz.fsf@web.de> <20170119175801.GB3397@acm.fritz.box> <877f5qbndp.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1484932141 13267 195.159.176.226 (20 Jan 2017 17:09:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2017 17:09:01 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: 25461@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 20 18:08:57 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUcg0-0001VC-KD for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2017 18:08:36 +0100 Original-Received: from localhost ([::1]:56080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUcg5-0007CT-DK for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2017 12:08:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUcXm-0000EV-Jp for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 12:00:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUcXj-00057H-9s for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 12:00:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38385) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUcXj-00056e-5a for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 12:00:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cUcXi-0003AP-M3 for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2017 12:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jan 2017 17:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25461 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25461-submit@debbugs.gnu.org id=B25461.148493155612083 (code B ref 25461); Fri, 20 Jan 2017 17:00:02 +0000 Original-Received: (at 25461) by debbugs.gnu.org; 20 Jan 2017 16:59:16 +0000 Original-Received: from localhost ([127.0.0.1]:36584 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUcWx-00038o-IX for submit@debbugs.gnu.org; Fri, 20 Jan 2017 11:59:15 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:49856 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cUcWu-00038f-SA for 25461@debbugs.gnu.org; Fri, 20 Jan 2017 11:59:13 -0500 Original-Received: (qmail 68114 invoked by uid 3782); 20 Jan 2017 16:59:11 -0000 Original-Received: from acm.muc.de (p548C7036.dip0.t-ipconnect.de [84.140.112.54]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 20 Jan 2017 17:59:11 +0100 Original-Received: (qmail 3502 invoked by uid 1000); 20 Jan 2017 16:58:56 -0000 Content-Disposition: inline In-Reply-To: <877f5qbndp.fsf@web.de> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128277 Archived-At: Hello, Michael. On Fri, Jan 20, 2017 at 00:12:18 UTC, Michael Heerdegen wrote: > Alan Mackenzie writes: > > > > +;; 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? > That `,' "signals" something is too vague to be true or false. As an > explanation of things, I don't find it good, and in the generality that > this sentence is speaking, I would say it's wrong. OK, I'll accept that. I can't see where it's wrong, though. I've changed it to say "causes" rather than "signal". (See below.) > That "," can only appear inside "`" is simply wrong. That's poor wording on my part. What I really meant was that for , to have the effect described, it must be in a ` construct. I've amended this bit too (see below). [ .... ] > It is also not the case that `pcase' redefines "`". pcase causes ` to be expanded by the macro \`--pcase-macroexpander in place of the macro \`. What is that if it is not pcase redefining `? > And yes, I've seen uses of "," outside of "`" in Lisp. And it's > perfectly fine to use "," for anything anyone wants - like any other > symbol. I disagree with you, here. Using standard Elisp symbols to mean something different is a recipe for confusion. I don't think it is in any way fine to use `if', `and', `car', .... for non standard purposes. I also don't think it's OK to do the same with ` or ,. > You don't seem to be confused by the fact that `rx' "(re-)uses" `and', > `or' etc. What makes "`" different? The fact that it is a "reader > macro"? I wasn't aware of rx. I don't think it was good to reuse `and' the way it does, but (subjectively) I don't think it will have caused all that much confusion. > > > 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. > Maybe. But you are describing properties of your mental model instead > of properties of the language. Your mental model led you to confusion > and wrong conclusions. I disagree with you, here. I'm describing the simple straighforward normal effect of ,. I don't understand why you're making such a big deal out of it. > It's not optimal to describe these things. It will confuse others. I disagree with you here, too. , and ,@ have a simply stated meaning in the typical case, far simpler than you're making it out to be. > > ` has a specific meaning, and has had a high quality doc string for > > ever. > Because it has a `symbol-function'. > > , likewise has a specific meaning, > That's one part that led you to confusion. > > but doesn't yet have a doc string. > ... because it is undefined. It is defined. I intend that definition to be in a doc string. > > > 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. > But that's exactly the point: "," is not a function or a macro. No, but it needs a doc string. > So how it is used is arbitrary. If that were the case, Emacs wouldn't even build. ,'s use is no more arbitrary than any other symbol in Lisp. > It's traditionally used by "`", but it's not restricted to that. > There may be even more use cases in future Elisp. And that is good. I disagree with that last sentiment. > > , 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.? > The manual seems to prefer the term "reader syntax". I think we could > use this term. No, that won't do. , has semantics as well as syntax. > You can say that the reader expands `X to (` X), and that "`" is a > defined macro. You can say that the reader expands ,X to (\, X), and > that a frequent usage is in backquote forms. That is describing the internal mechanism of , rather than the result. It would be utterly useless and confusing for the people who need to consult the meaning of , and ,@, namely new Elisp hackers. > We should not say that "," "does" something, because this makes no > sense and leads a person reading this to false assumptions. It will enable them to understand code they are reading, and to start writing ` constructs themselves. Here is the latest proposed version of the doc string for ,, incorporating some of the comments you've made. "`,' causes the next form to be evaluated and inserted. It occurs 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 `,@'. (Note that ``' constructs (including `,'s) sometimes have different semantics. This occurs, for example, with the macro `pcase' and other macros with similar names.") > Regards, > Michael. -- Alan Mackenzie (Nuremberg, Germany).