unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Poor quality documentation in edebug.el, and recursive documentation.
Date: Tue, 05 May 2020 18:18:26 -0400	[thread overview]
Message-ID: <jwv4ksuxcsg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20200505202048.GA15482@ACM> (Alan Mackenzie's message of "Tue, 5 May 2020 20:20:48 +0000")

>     Access slot "def-name" of `edebug--frame' struct CL-X.
>
> Huh?  Do I really care about whether it has a compiler macro?  I
> certainly care about what this function does, and the one liner is
> gibberish.

Not sure what you mean by gibberish.  The function itself is
a one-liner, all it does is (as the docstring says) is that it accesses
the slot called "def-name" of the struct CL-X which is presumed to be of
type `edebug--frame`.

> What significance does it have in edebug?

The "--" indicates it's an internal function.  These are quit often
not documented.

> What is the return value of this
> function?  All of these points are left open by this alleged doc string.
> What does CL-X mean?

It's the name of the argument, as always.  See the earlier line:

    (edebug--frame-def-name CL-X)

The choice of `CL-X` as argument name is indeed poor.  It should
probably be ARG or V or X instead.  The use of a `cl-` prefix is
a remnant of the time where we didn't have lexical scoping, IIRC.

> It carries on.  If you put point over the `edebug.el' and type <CR>, it
> doesn't go to the defining function, throwing an error instead.

Indeed, that's unfortunate.  We should improve either `cl-defstruct` or
`find-function` to fix this.

> It caries on further, and if anything, gets steadily worse: put point
> over `edebug-frame' and hit <CR>.  It leads to another vacuous doc
> string.

This one can be improved by the patch below (which is the kind of patch
you reject in CC-mode, ironically enough).

> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> So, what is a cl-structure-class?

You said so yourself: Since `edebug--frame` is a type of type
`cl-structure-class`, then `cl-structure-class` is a "type of types".
IOW a metaclass.

>      "cl-structure-class is a type (of kind `cl-structure-class')"
>
> embedded in approximately 26 lines, none of which shed any light on what
> a cl-structure-class is, does, or represents.

There actual docstring says: "The type of CL structs descriptors."
The rest describes the fields of those CL struct descriptors (aka class
objects).

Since we're in the realm of metaclasses here, it's no wonder that the
info you'll find here won't be very helpful to understand
`edebug--frame-def-name`.

> Following the link just redisplays the current doc string,
> ad infinitum.

Indeed, this metaclass is its own metaclass (that's the usual way to
stop the recursion).


        Stefan


diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index a376067443a..1b4bbb54e59 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -4169,12 +4169,12 @@ edebug-instrumented-backtrace-frames
   "Stack frames of the current Edebug Backtrace buffer with instrumentation.
 This should be a list of `edebug---frame' objects.")
 
-;; Data structure for backtrace frames with information
-;; from Edebug instrumentation found in the backtrace.
 (cl-defstruct
     (edebug--frame
      (:constructor edebug--make-frame)
      (:include backtrace-frame))
+  "Data structure for backtrace frames with information
+from Edebug instrumentation found in the backtrace."
   def-name before-index after-index)
 
 (defun edebug-pop-to-backtrace ()




  parent reply	other threads:[~2020-05-05 22:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 20:20 Poor quality documentation in edebug.el, and recursive documentation Alan Mackenzie
2020-05-05 20:39 ` Drew Adams
2020-05-05 21:11 ` Clément Pit-Claudel
2020-05-06 17:01   ` Alan Mackenzie
2020-05-06 18:20     ` Stefan Monnier
2020-05-06 18:34       ` Eli Zaretskii
2020-05-08 19:59       ` Alan Mackenzie
2020-05-09  5:53         ` Eli Zaretskii
2020-05-09 13:47           ` Stefan Monnier
2020-05-09 13:53             ` Eli Zaretskii
2020-05-09 14:56           ` Alan Mackenzie
2020-05-09 15:06             ` tomas
2020-05-09 15:12               ` Andreas Schwab
2020-05-09 15:11             ` Eli Zaretskii
2020-05-06 18:26     ` Stefan Monnier
2020-05-05 22:18 ` Stefan Monnier [this message]
2020-05-08 19:53   ` Alan Mackenzie
2020-05-08 20:24     ` Stefan Monnier
2020-05-12  6:33       ` Madhu
2020-05-12  7:42         ` Eli Zaretskii
2020-05-12 14:04         ` cl-generic misdesign (was: Poor quality documentation in edebug.el, and recursive documentation) Stefan Monnier
2020-05-14  5:03           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4ksuxcsg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).