[Top][All Lists]

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

Re: master 305dbc7 2/4: Move description of value to syntax-ppss functio

From: Lars Ingebrigtsen
Subject: Re: master 305dbc7 2/4: Move description of value to syntax-ppss function.
Date: Thu, 31 Oct 2019 15:06:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> 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'.
            (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

reply via email to

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