From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.bugs
Subject: bug#40671: [DOC] modify literal objects
Date: Sun, 26 Apr 2020 21:22:30 +0200
Message-ID:
References:
<83tv1finob.fsf@gnu.org> <1E9E4C19-37C2-4E24-91B7-8101F9CFBF35@acm.org>
<527dc4b5-3176-38b5-f2c1-1483ffc814a1@cs.ucla.edu> <87k12b6sv2.fsf@web.de>
<2225099d-16e1-645d-0342-a054da53363f@cs.ucla.edu> <87a7376nv9.fsf@web.de>
<99d7a8f9-7732-e1e3-414e-aabbea4433ac@cs.ucla.edu> <87o8rnasfk.fsf@web.de>
<9e6c138d-cb9f-6075-34df-a8d1d931343b@cs.ucla.edu> <871rofxbz9.fsf@web.de>
<93463227-33a8-85a0-fd19-8b29b75997f3@yandex.ru>
<969b3497-0afd-d104-6792-d744d31548fa@cs.ucla.edu>
<2935ec84-bdea-2e20-01b9-8ed08cc61c6c@yandex.ru>
<669981e5-f601-5c18-1a8b-ee316ad001ec@cs.ucla.edu>
<4b8b7e98-029e-58ac-59ff-6cd984b7eb85@yandex.ru>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202";
logging-data="1085"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: ke.vigouroux@laposte.net, 40671@debbugs.gnu.org,
Michael Heerdegen ,
Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= ,
Dmitry Gutov , Richard Stallman
To: Paul Eggert
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 26 21:23:13 2020
Return-path:
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.92)
(envelope-from )
id 1jSmrw-00009f-VI
for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 21:23:12 +0200
Original-Received: from localhost ([::1]:43454 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1jSmrv-0000XN-IN
for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 15:23:11 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47352)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from ) id 1jSmrm-0000Wx-Qw
for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 15:23:03 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1)
(envelope-from ) id 1jSmrm-0002YB-Bh
for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 15:23:02 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:51667)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1jSmrl-0002Xn-W4
for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 15:23:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
(envelope-from ) id 1jSmrl-0003Rq-SU
for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 15:23:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 26 Apr 2020 19:23:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 40671
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 40671-submit@debbugs.gnu.org id=B40671.158792897013201
(code B ref 40671); Sun, 26 Apr 2020 19:23:01 +0000
Original-Received: (at 40671) by debbugs.gnu.org; 26 Apr 2020 19:22:50 +0000
Original-Received: from localhost ([127.0.0.1]:34980 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1jSmrZ-0003Qr-Qr
for submit@debbugs.gnu.org; Sun, 26 Apr 2020 15:22:50 -0400
Original-Received: from mail-ot1-f50.google.com ([209.85.210.50]:40077)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from ) id 1jSmrX-0003QR-Tg
for 40671@debbugs.gnu.org; Sun, 26 Apr 2020 15:22:48 -0400
Original-Received: by mail-ot1-f50.google.com with SMTP id i27so22451669ota.7
for <40671@debbugs.gnu.org>; Sun, 26 Apr 2020 12:22:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=6rnRoRb9RZQqFfsdskKGmWsN8KJsse3lrdk8SDPrYnE=;
b=NuRoNEMSHcmEor1KcoTr4QdkUioSIofuJLrU6v9VEvTEQZdIj0+kiGZoXDNez0WM50
Her3CqdBQzdkbpi2Y2ZTt0xdVJoGZrzspdezoVXLe3axug46N3gQ53eiRM/w5PbiD9K1
KC9V1Nq/7o9+bwdyiaNkEBc0HVtYYLAvM7pe8R3xkR7doKcDR+SOb3nDobUt6+BuKi9u
DOZwLRDWwlwZu1O3NBEwnQtEpjpt3USacHaD2AUtoZUZu/Qsrd5b+lfwt7S947MpvcyG
wMQOcFIw4cRH+J45oZIh1hKSwTmjVo0EqdR5j2TqK3xY8Qijexz6Tp1uD4kmoYURjl8i
gjZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=6rnRoRb9RZQqFfsdskKGmWsN8KJsse3lrdk8SDPrYnE=;
b=SKYPXjajQd1OL606pR7aMcYPazy5RehqTW4RVtaesg7aJWIlvqQQ0oHru0IGc290RC
jILBprlHzSm/Tp/BsCtKPtPL6+V1L8iNo4XF8+Ju4Y3c5h32KWy1EDxxQfJIV2Zpxe4u
6gsiofMxykJKeCGW5dRdgDedZuyqIOdK8UoIIN+1FxpmvoiV1e68wY/I6e2bnfnjyMyC
PK/XQwWexWg6gsCdA63X8KPW6GCejfLTCK9Ae0Je0lKzjgSJVWwJ09teY3m8JyX5nCw+
W4O/StHpNoZEhLRFj/eJA29wAO0Z+rlTZ3LehqfxLnRW6WKLal0zaM12t16y9Ye0l/MV
DLbw==
X-Gm-Message-State: AGi0PuZoAyZOMlMhMCheLtnJ83fJuiM+S7UyCJnjjEVKQdzO5hHdxDdY
Xeo7vKpFu5sgGYAtUy61koHUnd0OUE/0X5hDfZA=
X-Google-Smtp-Source: APiQypKbFiMxMxHOx8IlrN6NYVv2rBjXXu9MMWTVKc0QSYwCMEM7cF3LSjAVoKpEWT5msVNKAKdrWG5P/gZF+U5fCmQ=
X-Received: by 2002:a9d:1408:: with SMTP id h8mr14683386oth.174.1587928962184;
Sun, 26 Apr 2020 12:22:42 -0700 (PDT)
In-Reply-To:
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-Received-From: 209.51.188.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
the Swiss army knife of text editors"
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
Xref: news.gmane.io gmane.emacs.bugs:179108
Archived-At:
Am So., 26. Apr. 2020 um 20:58 Uhr schrieb Paul Eggert :
>
> On 4/26/20 7:03 AM, Dmitry Gutov wrote:
> > g++ string_const.c++
>
> Ah, my example was C-only. Here is an example for both C and C++:
>
> #include
> int main (void) {
> union { char const *cp; char *p; } u = { "a" };
> return !strcpy (u.p, "b");
> }
>
> This has undefined behavior, and might dump core or might not depending on the
> implementation. Neither gcc nor g++ issue any warnings in default compilation.
Yes, but nobody "accidentally" writes code like this. OTOH, code like
attempting to mutate a "constant" Lisp object seems trivial to write
accidentally.
>
> Undefined behavior is undesirable and it's not a good thing that Emacs Lisp also
> has areas that behave like this. Somebody should pry free time to look into
> fixing them, but that won't be trivial.
What would be needed? We could either (a) remove the notion of
"constant" objects so that all objects become mutable, (b) introduce
static type checking including const-correctness so that attempting to
mutate a "constant" object would fail byte-compilation, and/or (c)
make it an error to mutate such objects at runtime (similar to (set t
nil)).