unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "rms@gnu.org" <rms@gnu.org>, Matt Armstrong <matt@rfc20.org>
Cc: "db48x@db48x.net" <db48x@db48x.net>,
	"eliz@gnu.org" <eliz@gnu.org>,
	"conao3@gmail.com" <conao3@gmail.com>,
	"monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: [External] : Re: [PATCH] Interpret #r"..." as a raw string
Date: Sun, 7 Mar 2021 17:20:10 +0000	[thread overview]
Message-ID: <SA2PR10MB4474F2110C7A7EF9A71F1B47F3949@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <E1lImf2-0000rR-D4@fencepost.gnu.org>

> Here's how I would write it.  It does not use "literal".
> It does use "constant", meaning that the object appears
> directly in the expressions and will be used at run time.
> 
> A constant does not have to be written in the source.
> It could be generated by a macro.
> 
> I've assumed that this applies to quoted lists, too, but
> I don't know for sure -- is it so?
> 
> I've made several other improvements in the punctuation and usage.
> I suggest installing those changes too.
> 
> ======================================================================
> The Emacs Lisp byte compiler may unify identical constant objects,
> including strings (which evaluate to themselves), and quoted objects,
> including lists, into references to one single object.  This has the
> effect that in the byte-compiled code the objects that were unified
> are ‘eq’, while when interpreting the same code they are not.
> 
> Therefore, your code should never rely on objects that are equal in
> contents to be either ‘eq’ or not ‘eq’; it should instead compare them
> using functions that compare object contents, such as ‘equal’,
> described below.  Similarly, your code should not modify an object that
> appears in the code---for instance, it should not put text properties
> on strings---since such alteration might affect other objects that
> have been unified with it.
> 
> ======================================================================

FWIW, I generally like, and agree with, your take on
this general subject.

I guess the only thing I'd suggest (if it's not already
the case), is that we say explicitly (somewhwere, where
this topic is covered) something like what you said in
your other mail today:

  But there is no distinction between "constant" and
  "variable", and what the code actually contains is
  a string.  A "constant string" is simply a string
  contained in the code.

This too is something not obvious to people not used
to Lisp.

A "constant" object _can_ in general be modified (e.g.
by users/code).  And in some cases (quite common) that's
not a good idea - it's instead a gotcha to beware of.

And the byte-compiler (or even the reader) can sometimes
create a "constant" object, and you might not be aware
of that happening.

(I said "can in general" because Lisp does sometimes
prevent some modification of some constant objects, such
as nil and t.)

The gotcha of inadvertently modifying an object that's,
in effect, "constant" is something to make users aware
of.  How best to do that, I'm not sure.  (That's been
discussed at length in the last year or so.)

Again, I think speaking about "constant" code objects
instead of "literals" is a step forward, (provided we
make clear that in some cases Lisp doesn't prevent you
from modifying such a "constant" object (intentionally
or not).

Your main point, about Lisp programs being data in
memory, not source code in files or buffers or on
paper, is an important one - to be emphasized.

  reply	other threads:[~2021-03-07 17:20 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 18:18 [PATCH] Interpret #r"..." as a raw string Naoya Yamashita
2021-02-26 18:27 ` [External] : " Drew Adams
2021-02-26 18:53   ` Naoya Yamashita
2021-02-26 19:03     ` Drew Adams
2021-02-26 19:48     ` Stefan Monnier
2021-02-26 20:23       ` Naoya Yamashita
2021-02-26 20:34         ` Andreas Schwab
2021-02-26 20:39           ` Naoya Yamashita
2021-02-26 20:45             ` Andreas Schwab
2021-02-26 20:50               ` Naoya Yamashita
2021-02-26 20:54                 ` Andreas Schwab
2021-02-26 20:03     ` Eli Zaretskii
2021-02-26 20:34       ` Naoya Yamashita
2021-02-26 19:09 ` Andreas Schwab
2021-02-26 20:00 ` Eli Zaretskii
2021-02-27  0:39   ` Daniel Brooks
2021-02-27 16:14     ` Richard Stallman
2021-02-27 16:18       ` Stefan Monnier
2021-03-01  5:19         ` Richard Stallman
2021-03-02  5:45           ` Matt Armstrong
2021-03-03  5:53             ` Richard Stallman
2021-03-03  6:14               ` Daniel Brooks
2021-03-03  7:00               ` Eli Zaretskii
2021-03-04  2:47                 ` Matt Armstrong
2021-03-04 13:49                   ` Eli Zaretskii
2021-03-04 16:55                     ` Matt Armstrong
2021-03-05  5:44                       ` Richard Stallman
2021-03-05  5:39                   ` Richard Stallman
2021-03-05  8:01                     ` Eli Zaretskii
2021-03-06  5:13                       ` Richard Stallman
2021-03-06  6:04                         ` Matt Armstrong
2021-03-07  6:13                           ` Richard Stallman
2021-03-07 17:20                             ` Drew Adams [this message]
2021-03-06  8:27                         ` Eli Zaretskii
2021-03-06  9:51                           ` Daniel Brooks
2021-03-06 10:24                             ` Eli Zaretskii
2021-03-07  6:08                           ` Richard Stallman
2021-02-27 20:41       ` Daniel Brooks
2021-02-28  6:22 ` Zhu Zihao
2021-03-01  5:26   ` Richard Stallman
2021-03-01 12:06 ` Alan Mackenzie
2021-03-01 12:13   ` Andreas Schwab
2021-03-02  5:59   ` Matt Armstrong
2021-03-02  9:56     ` Daniel Brooks
2021-03-02 10:13       ` Andreas Schwab
2021-03-02 10:55         ` Daniel Brooks
2021-03-02 11:18           ` Andreas Schwab
2021-03-02 11:26             ` Daniel Brooks
2021-03-02 11:14       ` Alan Mackenzie
2021-03-02 11:52         ` Daniel Brooks
2021-03-02 12:01     ` Dmitry Gutov
2021-03-02 14:14       ` Alan Mackenzie
2021-03-02 14:32         ` Dmitry Gutov
2021-03-02 15:06           ` Alan Mackenzie
2021-03-02 11:41 ` Aurélien Aptel
2021-03-02 13:49   ` Stefan Monnier
2021-03-02 14:46     ` Aurélien Aptel
2021-03-02 15:11       ` Stefan Monnier
2021-03-02 16:07         ` Aurélien Aptel
2021-03-03  7:31           ` Alfred M. Szmidt
2021-03-03 16:02           ` Stefan Monnier
2021-03-02 20:36     ` Daniel Brooks
2021-03-03  0:27       ` Stefan Monnier
2021-03-03  0:42         ` Daniel Brooks
2021-03-03  8:16       ` Andreas Schwab
2021-03-03  9:25         ` Daniel Brooks
2021-03-03  9:29           ` Andreas Schwab
2021-03-03 10:02             ` Daniel Brooks
2021-03-03 10:11               ` Daniel Brooks
2021-03-03 10:14                 ` Andreas Schwab
2021-03-03 11:48                   ` Daniel Brooks
2021-03-03 10:12       ` Michael Albinus
2021-03-03 10:42         ` Daniel Brooks
2021-03-03 10:49           ` Michael Albinus
2021-03-03 16:12           ` Stefan Monnier

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=SA2PR10MB4474F2110C7A7EF9A71F1B47F3949@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=conao3@gmail.com \
    --cc=db48x@db48x.net \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=matt@rfc20.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rms@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).