all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Chen Zhaoyang <chenzhauyang@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Escape syntax in docstrings
Date: Thu, 23 Mar 2023 23:02:08 +0100	[thread overview]
Message-ID: <6F82ED30-8C89-4DEE-B4B0-6F58E118BB41@gmail.com> (raw)
In-Reply-To: <87edpfnqln.fsf@gmail.com>

23 mars 2023 kl. 21.46 skrev Chen Zhaoyang <chenzhauyang@gmail.com>:

> Since when did emacs become stricter when enforcing the escape syntax in
> docstrings? On 27.1 (built by debian), this function evals to no error:
> 
> (defun slash-in-docstring ()
> "\x -> x"

Yes, this was changed recently, but I feel vindicated by your report: "\x" never meant what the author thought it did (or at least what I think the author thought it did): it is a hex escape without digits and used to be equivalent to "\000", yielding the control character NUL. Run `C-h f slash-in-docstring` in Emacs 29 or older and see for yourself.

The probability of anyone writing \x expecting NUL is, well, nil. It's guaranteed to be a mistake.

In fact, if you alpha-rename that doc string to "\y -> y" then Emacs won't complain but the doc string will still be wrong and behave as if you wrote "y -> y". (The 'relint' tool finds these things as an extra service.)

(That Emacs doesn't reject undefined character escape sequences such as "\y" is not only a constant source of bugs, it also makes it difficult for us to add new escape sequences without worrying about breaking some (misguided) code. Almost every other language complain about this.)

Thanks for your report -- I scanned all packages on my disk for occurrences of \x without digits when making the change and found none. Shame on me for not using HOL!

> (defun agda-input-compose (f g)
>  "\x -> concatMap F (G x)"

Good catch. Would you tell the Agdas about it?

> Can we document this change of behavior? 

Will do.





  reply	other threads:[~2023-03-23 22:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 20:46 Escape syntax in docstrings Chen Zhaoyang
2023-03-23 22:02 ` Mattias Engdegård [this message]
2023-03-24 16:17   ` James Cloos
2023-03-24 21:17   ` Philip Kaludercic
2023-03-28 12:14   ` Robert Pluim
2023-03-28 12:27     ` Andreas Schwab
2023-03-28 15:23       ` Robert Pluim
2023-03-24  4:04 ` Ruijie Yu via Emacs development discussions.
2023-03-24  4:44   ` Chen Zhaoyang
2023-03-24 18:29     ` Eli Zaretskii
2023-03-24 19:58       ` Chen Zhaoyang
  -- strict thread matches above, loose matches on Subject: below --
2023-03-23 22:32 Chen Zhaoyang
2023-03-24 13:22 ` Mattias Engdegård
2023-03-24 15:58 ` David Ongaro
2023-03-24 17:22   ` Chen Zhaoyang

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

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

  git send-email \
    --in-reply-to=6F82ED30-8C89-4DEE-B4B0-6F58E118BB41@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=chenzhauyang@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.