unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Alan Mackenzie <acm@muc.de>
Cc: Dmitry Gutov <dgutov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: master 305dbc7 2/4: Move description of value to syntax-ppss function.
Date: Thu, 31 Oct 2019 15:06:54 +0100	[thread overview]
Message-ID: <87tv7p6mbl.fsf@gnus.org> (raw)
In-Reply-To: <20191030203421.GA12640@ACM> (Alan Mackenzie's message of "Wed, 30 Oct 2019 20:34:21 +0000")

Alan Mackenzie <acm@muc.de> writes:

> For a start, why the prefix "ppss-"?  The values are the results of
> calling parse-partial-sexp (however indirectly), so "pps-" would be more
> accurate, as well as being a character shorter.

As syntax.el says:

;; Note: PPSS stands for `parse-partial-sexp state'

> I doubt these macros will be easier to read than the use of nth.  They
> are too long to be instantly recognised - the eye and the brain must
> scan them piece by piece.  (nth 3 s) can be a mental atom, requiring no
> effort.

No, (nth 3 s) can mean anything.  You first have to backtrack up the
code to see what s is, then go to the doc string for syntax-ppss, and
then go to the doc string for parse-partial-sexp to see what it means.

> In practice, by far most of the accesses to the state returned by
> parse-partial-sexp are elements 3, 4, and 8, so anybody using
> parse-partial-sexp quickly learns what these mean.  Others can be
> explained by comments, if needed.  Anybody who doesn't recognise elts 3,
> 4, and 8 is probably best advised to read the pertinent manual page
> anyway.

I think that's a kinda elitist way of looking at it.

If you don't understand obscure code, there's nothing wrong with you --
there's something wrong with the code.

Font locking is something normal users should be able to understand,
because it's something that's very visual, has an immediate impact, and
can be tweaked endlessly.  But reading the code today is much harder
than it has to be, and my guess is that many people will just bail when
presented with code like

      ;; Find each interesting place between here and `end'.
      (while
	  (progn
	    (when (or (nth 3 state) (nth 4 state))
	      (setq face (funcall font-lock-syntactic-face-function state))
              ...

I think we had the same discussion with decoded time accessors?  That
was a minor understandability hurdle compared to ppss -- at least there
you could sort of guess what they were because they were increasing
(minutes higher than seconds).  The ppss nths are completely inscrutable.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  parent reply	other threads:[~2019-10-31 14:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191030121649.15369.13207@vcs0.savannah.gnu.org>
     [not found] ` <20191030121651.BFCF8204DF@vcs0.savannah.gnu.org>
2019-10-30 14:59   ` master 305dbc7 2/4: Move description of value to syntax-ppss function Dmitry Gutov
2019-10-30 15:03     ` Lars Ingebrigtsen
2019-10-30 15:13       ` Dmitry Gutov
2019-10-30 15:22         ` Lars Ingebrigtsen
2019-10-30 15:26           ` Dmitry Gutov
2019-10-30 15:30             ` Lars Ingebrigtsen
2019-10-30 15:29           ` Lars Ingebrigtsen
2019-10-30 16:13             ` Dmitry Gutov
2019-10-30 16:17               ` Lars Ingebrigtsen
2019-10-30 16:47                 ` Dmitry Gutov
2019-10-30 17:03                   ` Lars Ingebrigtsen
2019-10-30 19:39             ` Stefan Monnier
2019-10-30 20:28               ` Lars Ingebrigtsen
2019-12-13 12:34                 ` Noam Postavsky
2019-12-13 13:03                   ` Dmitry Gutov
2019-12-17 16:28                     ` Lars Ingebrigtsen
2020-02-15 14:55                     ` Noam Postavsky
2020-02-15 15:14                       ` Dmitry Gutov
2020-02-15 16:23                         ` Noam Postavsky
2020-02-23 14:11                           ` Noam Postavsky
2019-10-30 20:34             ` Alan Mackenzie
2019-10-30 20:41               ` Dmitry Gutov
2019-10-31  1:45               ` Stefan Monnier
2019-10-31 14:06               ` Lars Ingebrigtsen [this message]
2019-10-30 20:47           ` Alan Mackenzie

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=87tv7p6mbl.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=acm@muc.de \
    --cc=dgutov@yandex.ru \
    --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).