From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: uzibalqa via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#64960: Documentation for copy-sequence Date: Mon, 31 Jul 2023 01:50:17 +0000 Message-ID: References: <83leex2qmn.fsf@gnu.org> <9fd2cf2e-04f7-380e-d8e3-dacb0a14a98d@gutov.dev> <3aitpaf8HcjBZemQByxzBRz3i0bgDDKSSyOql9xR-eoh8a8rDWhxGYvYxa8C0RjrEWtoELtkMI1V4s9VhAjR47CMaPQ5HChKcKmAXKQaSGw=@proton.me> <445c7635-2da3-0dc6-a1cf-c840cecca337@gutov.dev> Reply-To: uzibalqa 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="28453"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , Eli Zaretskii , "64960@debbugs.gnu.org" <64960@debbugs.gnu.org> To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 31 03:51:24 2023 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 1qQI4B-0007CY-Oj for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Jul 2023 03:51:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQI3s-00011L-T9; Sun, 30 Jul 2023 21:51:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQI3q-00010v-34 for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 21:51:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQI3p-0006J3-RI for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 21:51:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qQI3p-0001nI-Nt for bug-gnu-emacs@gnu.org; Sun, 30 Jul 2023 21:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: uzibalqa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Jul 2023 01:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64960 X-GNU-PR-Package: emacs Original-Received: via spool by 64960-submit@debbugs.gnu.org id=B64960.16907682406869 (code B ref 64960); Mon, 31 Jul 2023 01:51:01 +0000 Original-Received: (at 64960) by debbugs.gnu.org; 31 Jul 2023 01:50:40 +0000 Original-Received: from localhost ([127.0.0.1]:51468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQI3U-0001mj-5u for submit@debbugs.gnu.org; Sun, 30 Jul 2023 21:50:40 -0400 Original-Received: from mail-40130.protonmail.ch ([185.70.40.130]:53211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQI3S-0001mT-NI for 64960@debbugs.gnu.org; Sun, 30 Jul 2023 21:50:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1690768232; x=1691027432; bh=2pWhmF9q99tqVjpnJrGriDjQDL3ia0zaDm88KzrN4ME=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=Zrkz51SiyE4UbS4k+NdDq2r91vqmAMGViLJJ776s4P5aRRKcXgh2R4Ve19o5SXV/B pTT7popVTBNNR2RKynLoibjrZcMqFIFT10GKpe3TENC9L55ksdLYBHoLSxZzVRJusV ump94uoO4FTNOqVYO+XRifxbzea1TyN6NnEdXuxZ3JjLIvqItWyM3HUKM1FGWqACw/ LemnFpUzw3+j2clh1NrMudz9ZN/YJSG4QiNJV8qJWyCKo9x0BkvEbIJWCFMQOqGn/+ gJas2sH69iOSoXLBS/N27NB3gmwforsCsWOQdcm5o3X4lzOJdPreZQDLB9n3n5hWHJ P2w7SgjfDyyDw== In-Reply-To: Feedback-ID: 52887082:user:proton 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266389 Archived-At: ------- Original Message ------- On Monday, July 31st, 2023 at 1:36 PM, Drew Adams w= rote: > > > > A string doesn't share anything because characters are not referenc= e > > > > values. They are simply copied. > > >=20 > > > Yes and no. > > > Chars are not shared, but char properties are. > > >=20 > > > (setq foo (propertize "abcd" 'p1 t 'p2 42)) > > > ;; -> #("abcd" 0 4 (p2 42 p1 t)) > > > (setq bar (copy-sequence foo)) > > > ;; -> #("abcd" 0 4 (p1 t p2 42)) > > > (aset foo 1 ?W) ; -> ?W, aka 87 > > > foo ; -> #("aWcd" 0 4 (p2 42 p1 t)) > > > bar ; -> #("abcd" 0 4 (p1 t p2 42)) > >=20 > > Ok, meaning that the actual string becomes different, yet changing > > the a property, changes the property on both foo and bar ? >=20 >=20 > No. I didn't change a property. I swapped one > char for another. The doc says that the arg's > "elements" are shared. A string's "elements" > are its chars. But as Yuri pointed out, the > chars themselves aren't shared, because they > aren't sharable: they aren't references. You only changed a character, which is not actually sharable. But if I go change a property value for foo, I should see the change also in bar, or not ? =20 > Strings can also have properties. We sometimes > say that it's the characters that have the > properties, but really it's that the properties > are attached to the characters in the string or > buffer - the properties are associated with > string or buffer positions. The chars themselves > don't really have properties. The properties are > shared when you copy a string; the chars are not. Meaning that I can make a copy of a string just to have=20 the same properties (e.g, colour). =20 > This is really more of a natural-language nuance, > about what it means for string elements to be > shared. You can ignore it, if what I'm saying > just confuses things. Not too confusing, but required some attention. Currently I am only interested in the actual characters in my implementation where properties are not important. Yet in my permute implementation I have seen that whether I just use string or (copy-sequence string) does make a huge difference. Quite difficult to understand what's going on.