From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#42296: 27.0.91; Correct manual entry for 'concat' w.r.t. allocation [PATCH] Date: Sat, 11 Jul 2020 09:17:30 -0700 (PDT) Message-ID: <01440768-3233-4406-831f-f7143471b600@default> References: <83wo3cppc5.fsf@gnu.org> <669987BB-B825-4C2C-B9FD-31F04E0D6013@acm.org> <83r1tkplnc.fsf@gnu.org> <83o8oopk4s.fsf@gnu.org> <70B05C00-862D-412B-83DA-7129BF49C322@acm.org> <834kqfp7ir.fsf@gnu.org> <87CAAEDE-4AE2-4224-A3E3-6597E6449B1D@acm.org> <83o8omnu9y.fsf@gnu.org> <1E70112B-0D00-4D94-9696-AA3DE75C9862@acm.org> <83k0zanqsr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17946"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42296@debbugs.gnu.org To: Eli Zaretskii , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 11 18:18:11 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 1juICY-0004Z8-El for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Jul 2020 18:18:10 +0200 Original-Received: from localhost ([::1]:52566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juICX-0006zO-GA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Jul 2020 12:18:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juICQ-0006zD-Sw for bug-gnu-emacs@gnu.org; Sat, 11 Jul 2020 12:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33289) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1juICQ-0001HR-Ez for bug-gnu-emacs@gnu.org; Sat, 11 Jul 2020 12:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1juICP-0008NG-MR for bug-gnu-emacs@gnu.org; Sat, 11 Jul 2020 12:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Jul 2020 16:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42296 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 42296-submit@debbugs.gnu.org id=B42296.159448426532166 (code B ref 42296); Sat, 11 Jul 2020 16:18:01 +0000 Original-Received: (at 42296) by debbugs.gnu.org; 11 Jul 2020 16:17:45 +0000 Original-Received: from localhost ([127.0.0.1]:44835 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juIC8-0008Mk-Sl for submit@debbugs.gnu.org; Sat, 11 Jul 2020 12:17:45 -0400 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:53894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juIC6-0008MW-33 for 42296@debbugs.gnu.org; Sat, 11 Jul 2020 12:17:43 -0400 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06BGGkbq147219; Sat, 11 Jul 2020 16:17:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=u/Ny+RgASCQm/T3XsFMMl+aVBqYlozM2hEfr9ohtDAo=; b=QRcaL3gM8yTViTghEMpiaK8n9rlRH/mkyHaCwSnW6l9G7HFIpuUmOXCI4/sQKemmTGoF Q77zzjUrRNFDxwtlMJZtgVeNwLSTSwAGRdaeQKEPyU8xO/WsasDg0Q6bjX0/nK/f5mTA 9G2nVxeGMQ6y6/eVxJkVL9165dlDquVMwzhGeJBeKK0XRezhxheYi4T8BFWWaX7zQwBw QbuzLvHOZE0AlaLKuAV59NvhP5Lkz4UhBnn0LIBk2Ic2lfjRwvl93UBRjFE5Df1gJf46 BxJsCHiAE4b0VKxF8Z6ukgjGenWSLKGsZvqedBfLOBupmgxbEt1KdH6IBrI3F4zbvxt1 pg== Original-Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 3275cksp2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 11 Jul 2020 16:17:34 +0000 Original-Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06BGDOmX081041; Sat, 11 Jul 2020 16:17:34 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 327581jnqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 11 Jul 2020 16:17:34 +0000 Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06BGHVlC021770; Sat, 11 Jul 2020 16:17:31 GMT In-Reply-To: <83k0zanqsr.fsf@gnu.org> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.5017.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9679 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007110126 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9679 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007110126 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:182924 Archived-At: > > This function does not always allocate a new string. Callers are > > advised not rely on the result being a new string nor on it being > @code{eq} > > to an existing string. > > > > In particular, mutating the returned value may inadvertently change > another > > string, alter a constant string in the program, or even raise an > error. > > To obtain a string that can be mutated, use @code{copy-sequence} on > the result. >=20 > Fine with me, with one correction: last sentence will sound better if > reworded like this: >=20 > To obtain a string that you can safely mutate, use > @code{copy-sequence} on the result. FTR, I think that the doc of `concat' should really make clear that it (now, and apparently for a while now) has this odd (yes) behavior of not guaranteeing a new string. Not sure why we made this change, but I imagine it was in a zeal to optimize. At a minimum, please make this very clear, and say explicitly that to ensure that you get a new string you can use `copy-sequence' (as you've mentioned), and that you can alternatively use `seq-concatenate': (seq-concatenate 'string &rest SEQUENCES)