Received: (at 76017) by debbugs.gnu.org; 14 Feb 2025 14:58:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 14 09:58:24 2025 Received: from localhost ([127.0.0.1]:51126 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tix95-0001Pk-J6 for submit <at> debbugs.gnu.org; Fri, 14 Feb 2025 09:58:24 -0500 Received: from mta-10-4.privateemail.com ([198.54.122.149]:51772) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <basil@HIDDEN>) id 1tix92-0001PU-SS for 76017 <at> debbugs.gnu.org; Fri, 14 Feb 2025 09:58:21 -0500 Received: from mta-10.privateemail.com (localhost [127.0.0.1]) by mta-10.privateemail.com (Postfix) with ESMTP id 4YvZtG4f9Hz3hhTm; Fri, 14 Feb 2025 09:58:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net; s=default; t=1739545094; bh=gGPNAL9GRXavgUVvJ6read3POi+XPpOZtsEBerLG7cc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HRPlS5yRj845M1mFb2GbZFt6seio2B+R4tfiLebwxyUWW/NToIHxk+bOmp8TaGYno 6JYGBrIxKaSaoFgGUCXheWPkcbrKocHVQnOWaBSJlUB6lOEFIdIQH2YCeKoWZOIqMs wttz/8OH3Lkq8Wu07a1FrlpJrD15SvD1o4PMRZ21jXITYzkJ3eCOtGR1DmpLLOXYcu N0b13a/ZhPIhj9rQQvjwOBByPh41rAs3T96szkyMMzudJIwb08R9T5GYKkLF6ffVhZ 6hx1ikYS3gavfa08fLZ+waIesis0YCLHyTSkO4pDuiiyqiSXHjFzFUzOj/tMkBMQ2H oG/oUzILU8iTA== Received: from localhost (unknown [31.46.244.117]) by mta-10.privateemail.com (Postfix) with ESMTPA; Fri, 14 Feb 2025 09:58:10 -0500 (EST) From: "Basil L. Contovounesios" <basil@HIDDEN> To: Pip Cet <pipcet@HIDDEN> Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? In-Reply-To: <87v7tcn5jj.fsf@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> <8734gh4srv.fsf@HIDDEN> <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> <87v7tcn5jj.fsf@HIDDEN> Date: Fri, 14 Feb 2025 15:58:04 +0100 Message-ID: <87pljka803.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 76017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Pip Cet [2025-02-14 11:13 +0000] wrote: > Maybe if feature/igc is merged, and becomes a common option, we can > formally make cl-nintersection an alias of cl-intersection, I haven't followed most of the feature/igc developments; how do they affect the choice of whether cl-nintersection aliases cl-intersection? > rather than > the currenet somewhat redundant wrapper. I would sooner attempt a destructive implementation before giving up; maybe tomorrow=E2=84=A2. > As a followup, I would like to propose removing claims of cons cells > being reused "whenever possible", though: we reserve the right to > mutate one of the arguments, but we don't, so we shouldn't make such > claims. (And what's "whenever possible" supposed to mean, anyway? All > cons cells are equal!) The right to mutate one of the arguments is the function's raison d'=C3=AAtre, and its users ought to be made aware of that before they choose to use it. Today the implementation suffers from a clear performance bug, but tomorrow that might be fixed, and at such time its already informed users will automatically benefit from the fix. Thanks, --=20 Basil
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Received: (at 76017-done) by debbugs.gnu.org; 14 Feb 2025 14:48:17 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 14 09:48:17 2025 Received: from localhost ([127.0.0.1]:47840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tiwzI-000073-V4 for submit <at> debbugs.gnu.org; Fri, 14 Feb 2025 09:48:17 -0500 Received: from mta-07-3.privateemail.com ([198.54.118.214]:48045) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <basil@HIDDEN>) id 1tiwzG-00006h-2s; Fri, 14 Feb 2025 09:48:15 -0500 Received: from mta-07.privateemail.com (localhost [127.0.0.1]) by mta-07.privateemail.com (Postfix) with ESMTP id 4YvZfb03Skz3hhV9; Fri, 14 Feb 2025 09:48:07 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net; s=default; t=1739544487; bh=Yqxft4xZCXpHuP9NZ7NbtLvUn2BIB38E0rpCJr8T/XI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=c9qcwrbIHCQj/mI4JKPU6oRiBQmraIe+A1RwuH/7j99LZfA2dbX6XmUdD8yojTJZ/ Nc2XEvEN8b57xvtlISBROS1eBH7KmTL1vtDkcAOworMn8yQr93VYI5wHgj0OO90iUE 0Z3xW5dJqs6GH9ALDF3KC8n8ZDLMnRT3vnZSaxjDfirzkGZeirknenF+0Bxazhv6z8 D/kmgGaxpF73fePbErrAtNgsCw0JcZnYhl2q151NcJrtfPYpqqcqaDy+ZNzOcS1Wck uRCFV2e+UCchRkYkK9dXxhw1zLLfreuoe1dp+iUUEXhB/nYUePOhuu0W0RSDYfVhVy vjmcMxRIW4V8w== Received: from localhost (unknown [31.46.244.117]) by mta-07.privateemail.com (Postfix) with ESMTPA; Fri, 14 Feb 2025 09:48:02 -0500 (EST) From: "Basil L. Contovounesios" <basil@HIDDEN> To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN> Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? In-Reply-To: <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> <8734gh4srv.fsf@HIDDEN> <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> Date: Fri, 14 Feb 2025 15:47:56 +0100 Message-ID: <87frkgbn1f.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017-done Cc: Pip Cet <pipcet@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 76017-done <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) close 76017 31.1 quit Mattias Engdeg=C3=A5rd [2025-02-14 12:03 +0100] wrote: > 13 feb. 2025 kl. 19.13 skrev Basil L. Contovounesios <basil@HIDDEN>: > >> I propose the attached. > > Thank you, this should be fine. I was clearly over-cautious in labelling = the > second arguments to those functions as destructive in mutates-arguments, = and > agree that there is no significant advantage to preserving the right to m= utate > it (which we never really had in the first place). Thanks, now applied. Document cl-n... set operations consistently ac143186c04 2025-02-14 15:42:52 +0100 https://git.sv.gnu.org/cgit/emacs.git/commit/?id=3Dac143186c04 --=20 Basil
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available."Basil L. Contovounesios" <basil@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 76017) by debbugs.gnu.org; 14 Feb 2025 11:13:40 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 14 06:13:40 2025 Received: from localhost ([127.0.0.1]:47311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1titdb-000090-Qb for submit <at> debbugs.gnu.org; Fri, 14 Feb 2025 06:13:40 -0500 Received: from mail-10630.protonmail.ch ([79.135.106.30]:33261) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>) id 1titdZ-00008j-5M for 76017 <at> debbugs.gnu.org; Fri, 14 Feb 2025 06:13:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1739531609; x=1739790809; bh=zYxV2jJ/NduXOfFSuNl6iGlMwYsv+urnn7Gw+UQC+ho=; 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:List-Unsubscribe:List-Unsubscribe-Post; b=RhqfJsU4oCpvfrs6tZekYzEAFGCAhp+ivwc+0zKxbGXYEARoblFAQbHp/KIzLW1/e LdEBohHm6LAIq/E+7PbgiLhnJFiOSdP1XhJ3n2L/UMEG91PIaFxUUmw05fTYZzyvvR w8vvtT8tMy8wfsul27vFcLaTlfroM00E3HnRStC70vp6NuIv5EP7iyoGM7o7GyL0tU UP2XY82GV+f2Xs4U6sHSCOaq2uhMSq3jCBE5I/QAOQu0XfXWjmyA1/4mxZmRrHxwg9 Ez5N6HrlWflSFS/Grd9ihBYxAgAi6l7yeoq3RkWN9/HNUqdYYXvaOym2MCPsZIK76w ALbRQt0V2ppzw== Date: Fri, 14 Feb 2025 11:13:24 +0000 To: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN> From: Pip Cet <pipcet@HIDDEN> Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? Message-ID: <87v7tcn5jj.fsf@HIDDEN> In-Reply-To: <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> <8734gh4srv.fsf@HIDDEN> <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: fbb02e1f632d86720908555ad564e86c2a784898 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: "Basil L. Contovounesios" <basil@HIDDEN>, 76017 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Mattias Engdeg=C3=A5rd <mattias.engdegard@HIDDEN> writes: > 13 feb. 2025 kl. 19.13 skrev Basil L. Contovounesios <basil@HIDDEN>= : > >> I propose the attached. > > Thank you, this should be fine. I was clearly over-cautious in > labelling the second arguments to those functions as destructive in > mutates-arguments, and agree that there is no significant advantage to > preserving the right to mutate it (which we never really had in the > first place). It seems to me the only possible advantage in the cl-nset-difference case is you could sort (and possibly uniq) both lists in place and traverse the sorted lists. But that would require many changes to the current Emacs code, and I don't think it's going to happen. Similarly, the "mutate the shorter list" thing for cl-intersection seems unlikely. Maybe if feature/igc is merged, and becomes a common option, we can formally make cl-nintersection an alias of cl-intersection, rather than the currenet somewhat redundant wrapper. As a followup, I would like to propose removing claims of cons cells being reused "whenever possible", though: we reserve the right to mutate one of the arguments, but we don't, so we shouldn't make such claims. (And what's "whenever possible" supposed to mean, anyway? All cons cells are equal!) Pip
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Received: (at 76017) by debbugs.gnu.org; 14 Feb 2025 11:03:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 14 06:03:45 2025 Received: from localhost ([127.0.0.1]:47281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1titU1-00086x-Fv for submit <at> debbugs.gnu.org; Fri, 14 Feb 2025 06:03:45 -0500 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]:42384) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <mattias.engdegard@HIDDEN>) id 1titTy-00086c-Ib for 76017 <at> debbugs.gnu.org; Fri, 14 Feb 2025 06:03:43 -0500 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-308dfea77e4so21395291fa.1 for <76017 <at> debbugs.gnu.org>; Fri, 14 Feb 2025 03:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739531016; x=1740135816; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=37HPn4IUD3+0AmX0r81P1LJ6Nr0jwL4+hqv8TO3KKXc=; b=f2AaYL/m5zqP4rs728cd6pzkiVTCvgSlJzkOD5wa1V/WTQjZip76o8DekEj92cwsNA oWrUWEF8htm+Bip+EIva2TiUmDYDBUg4Atf1pHT8gY4yiuW3Q9X8C5P81cdPYKtPPer3 L90CIWs+mndzoe2OldRhMK+2Z4HazT7Yc0s+S/20nnD1Al0U0whlQUzLetr0N2F/EHvl IFM6cuS2ofkKMPyLcBwOjStUIgp3lP06GFeochPGkQ1Qj5RIaElchmdUpW5xtqohxtDz MHI2kEzgxoURMkefmbTMUMmj2YOq+JeDty84wfmaeJCEiGF1lAPXgEdMGL4G8n3rI14U JWwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739531016; x=1740135816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=37HPn4IUD3+0AmX0r81P1LJ6Nr0jwL4+hqv8TO3KKXc=; b=AqZBEEfEKeK+EN/2GjORC8Mt5E876tjWZxAKf+adXE2Q+GeOiFxrt2hNMhB7CtumUk btc9mizcoP4+n+Kg8ow/vjEPQzjWNjveIYNDyJVRXiwHfpdcaHsjWL8HFq7bBcZ/NDSO XzH+Z+ZyENzi+D+hTEk+vY93uRSlM8WUXjhhM/VyZhrM8ogptMxU99EjFOJ04j+WD7Ze 1qqkgGl/B2CZ3Bzg2PQhJdNTiJ77IXb25XWuVmIgI8nQKIee/StgW+Hj80L68YB4YK52 YuWSFIT58mGl/xSODLeXeUxPCl+6SiDAxgR2KvkyUDVQ5+gcxr7msVc7Y1C/SIXLeTWt Ew7w== X-Gm-Message-State: AOJu0YzYMBzYnnxLrye8ehNTUZR7Ti27PCbYZ1vPrIWWBy2XI7WsMgl0 WoYlgmNyxvPehBDjddRfcFc+O0spcCJF8VXKCIdtbZrfzL7uyJb9 X-Gm-Gg: ASbGncsAa9iLBraEAihZXEs6H0mPXVmR5w0KTYVnTwC6uaTCBOhlhRkECDTNAXD9Yo8 lJGB8RL+I5lGOYe1d9j5nWNaUfjn8ucD1QgUYQUtkNAgS6XCulg21glQVSQwygj/lUXf2YR6ULq UOJ6hTGRw6hH7/wSQZKCl4I4FZ02mwINn9FiKhuEEom92t1bvpadPm7QPN2qMeuRuN+CWTxBrBf BdNafmhb3rb5cZoKg5DVU44GKtFJzvyXaXjlqHRf9ZDJDTDtA9L54CmQ2MyeBF0/tvgfMyhDSJf YV3WtqUfE47DvAMIpIkxFthvtpi2q2bJQswPh2idN11p1dz4oJNEIJo2UbaAu2OddL3ukzoBFCS Ckdhtpw== X-Google-Smtp-Source: AGHT+IH2MsoErvfWgvNpJaufLMN2WMsflHVJhXUBKcDBfBdYAAoEf7bRysLlKIZtO9cIKNg3268ihQ== X-Received: by 2002:a2e:8a81:0:b0:309:2187:2cd9 with SMTP id 38308e7fff4ca-3092187335amr4853601fa.7.1739531015754; Fri, 14 Feb 2025 03:03:35 -0800 (PST) Received: from smtpclient.apple (c188-150-186-155.bredband.tele2.se. [188.150.186.155]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-309100c53c7sm5380581fa.3.2025.02.14.03.03.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Feb 2025 03:03:35 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN> In-Reply-To: <8734gh4srv.fsf@HIDDEN> Date: Fri, 14 Feb 2025 12:03:33 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <EE2B5276-2BED-4899-9111-0B97DE522B4B@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> <8734gh4srv.fsf@HIDDEN> To: "Basil L. Contovounesios" <basil@HIDDEN> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: Pip Cet <pipcet@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 76017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) 13 feb. 2025 kl. 19.13 skrev Basil L. Contovounesios = <basil@HIDDEN>: > I propose the attached. Thank you, this should be fine. I was clearly over-cautious in labelling = the second arguments to those functions as destructive in = mutates-arguments, and agree that there is no significant advantage to = preserving the right to mutate it (which we never really had in the = first place).
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Received: (at 76017) by debbugs.gnu.org; 13 Feb 2025 18:13:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 13 13:13:59 2025 Received: from localhost ([127.0.0.1]:45419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tidio-0002Xr-Mf for submit <at> debbugs.gnu.org; Thu, 13 Feb 2025 13:13:59 -0500 Received: from mta-11-4.privateemail.com ([198.54.127.104]:61313) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <basil@HIDDEN>) id 1tidil-0002XW-9m for 76017 <at> debbugs.gnu.org; Thu, 13 Feb 2025 13:13:56 -0500 Received: from mta-11.privateemail.com (localhost [127.0.0.1]) by mta-11.privateemail.com (Postfix) with ESMTP id 4Yv3GN04h4z3hhVG; Thu, 13 Feb 2025 13:13:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net; s=default; t=1739470428; bh=aW71cGHluFck5EhyUOpkcODzptkS+l9vckT6VWPbOpM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=A0CUkfldDDgRgNVuoCVYhffLRySQIimb4wBbKq11ygT4KRzqUisBUsCsodKDqfZJO cVJrJWR2ge9MIoZn06odml6gNdc1s5SzFDJQkvm5wBhLKe2cgh8f5onWJQ4fmbLYG7 oRtDqAcRfDgCqIX/39lW3/MK1agAkJjoy/Dp+vWGiTRTVl45ack8E7uf1Z/m+BFrxc lAkv8Pi00XnENaWreP38qDDAy7HxOR7cnrW8xTqMcRvnFKWARPtHUHfax3+49l8OHp VAbzD/+CL53TWaS+MU5Gice9tvxlwkaPgqTzXHyybIzEbrACsC31pn0BUg+XvV+xc0 /nwspvo7xMciw== Received: from localhost (unknown [146.70.196.137]) by mta-11.privateemail.com (Postfix) with ESMTPA; Thu, 13 Feb 2025 13:13:43 -0500 (EST) From: "Basil L. Contovounesios" <basil@HIDDEN> To: 76017 <at> debbugs.gnu.org Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? In-Reply-To: <87h65cgruv.fsf@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> Date: Thu, 13 Feb 2025 19:13:40 +0100 Message-ID: <8734gh4srv.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: Pip Cet <pipcet@HIDDEN>, Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Basil L. Contovounesios [2025-02-02 18:48 +0100] wrote: > If there is agreement, I can follow up with a patch for our docs and > tests. I propose the attached. WDYT? [ I'm not sure whether it applies cleanly as is; it builds on the unrelated patch proposed in https://bugs.gnu.org/75633#22. ] Thanks, -- Basil --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-Document-cl-n.-set-operations-consistently.patch From ad89034f0bfd18461af2f93ab00768efefd64e7f Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" <basil@HIDDEN> Date: Sun, 2 Feb 2025 18:05:57 +0100 Subject: [PATCH 2/2] Document cl-n... set operations consistently The docstrings of cl-nintersection and cl-nset-difference have been inconsistent with their manual entries since the beginning of emacs.git history (bug#76017). This patch settles on the weaker and thus backward-compatible requirement that only their first argument be safe to mutate. * lisp/emacs-lisp/bytecomp.el: Include only first argument in mutates-arguments property. * lisp/emacs-lisp/cl-seq.el (cl-nintersection, cl-nset-difference): Make docstring consistent with manual in that the second argument is not modified. * test/lisp/emacs-lisp/cl-seq-tests.el (cl-nintersection-test) (cl-nset-difference-test): Simplify. (cl-nset-difference): Pass fresh list as second argument, otherwise destructive modifications to it could go undetected. --- lisp/emacs-lisp/bytecomp.el | 2 +- lisp/emacs-lisp/cl-seq.el | 8 +++--- test/lisp/emacs-lisp/cl-seq-tests.el | 42 +++++++++++++++------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 931b155313e..2ddbb2ec1da 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3583,7 +3583,7 @@ bytecomp--mutargs-sort (cl-nsubst 3) (cl-nsubst-if 3) (cl-nsubst-if-not 3) (cl-nsubstitute 3) (cl-nsubstitute-if 3) (cl-nsubstitute-if-not 3) (cl-nsublis 2) - (cl-nunion 1 2) (cl-nintersection 1 2) (cl-nset-difference 1 2) + (cl-nunion 1 2) (cl-nintersection 1) (cl-nset-difference 1) (cl-nset-exclusive-or 1 2) (cl-nreconc 1) (cl-sort 1) (cl-stable-sort 1) (cl-merge 2 3) diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index 1878153f811..5b4337ad9cb 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -864,8 +864,8 @@ cl-intersection (defun cl-nintersection (cl-list1 cl-list2 &rest cl-keys) "Combine LIST1 and LIST2 using a set-intersection operation. The resulting list contains all items that appear in both LIST1 and LIST2. -This is a destructive function; it reuses the storage of LIST1 and LIST2 -whenever possible. +This is a destructive function; it reuses the storage of LIST1 (but not +LIST2) whenever possible. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (and cl-list1 cl-list2 (apply 'cl-intersection cl-list1 cl-list2 cl-keys))) @@ -894,8 +894,8 @@ cl-set-difference (defun cl-nset-difference (cl-list1 cl-list2 &rest cl-keys) "Combine LIST1 and LIST2 using a set-difference operation. The resulting list contains all items that appear in LIST1 but not LIST2. -This is a destructive function; it reuses the storage of LIST1 and LIST2 -whenever possible. +This is a destructive function; it reuses the storage of LIST1 (but not +LIST2) whenever possible. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (if (or (null cl-list1) (null cl-list2)) cl-list1 diff --git a/test/lisp/emacs-lisp/cl-seq-tests.el b/test/lisp/emacs-lisp/cl-seq-tests.el index 2348a7fc812..f72596e4a4b 100644 --- a/test/lisp/emacs-lisp/cl-seq-tests.el +++ b/test/lisp/emacs-lisp/cl-seq-tests.el @@ -914,18 +914,18 @@ cl-intersection-test (ert-deftest cl-nintersection-test () (should-not (cl-nintersection () ())) - (should-not (cl-nintersection () (list 1 2 3))) - (should-not (cl-nintersection (list 1 2) (list 3 4))) - (should (equal (cl-nintersection (list 1 2 3 4) (list 3 4 5 6)) + (should-not (cl-nintersection () '(1 2 3))) + (should-not (cl-nintersection (list 1 2) '(3 4))) + (should (equal (cl-nintersection (list 1 2 3 4) '(3 4 5 6)) '(4 3))) - (should (equal (cl-nintersection (list 1 2 3) (list 1 2 3)) + (should (equal (cl-nintersection (list 1 2 3) '(1 2 3)) '(1 2 3))) - (should (equal (cl-nintersection (list 1 1 2 2 3) (list 2 2 3 4)) + (should (equal (cl-nintersection (list 1 1 2 2 3) '(2 2 3 4)) '(3 2 2))) (should (equal (cl-nintersection (list 1 (copy-sequence "two") 3) - (list 3 "two" 4)) + '(3 "two" 4)) '(3))) - (should (equal (cl-nintersection (list 1 2 3) (list 3 2 1) :test #'equal) + (should (equal (cl-nintersection (list 1 2 3) '(3 2 1) :test #'equal) '(1 2 3)))) (ert-deftest cl-set-difference-test () @@ -961,47 +961,49 @@ cl-set-difference-test (ert-deftest cl-nset-difference () ;; Our nset-difference doesn't preserve order. - (let* ((l1 (list 1 2 3 4)) (l2 '(3 4 5 6)) + (let* ((l1 (list 1 2 3 4)) (l2 (list 3 4 5 6)) (diff (cl-nset-difference l1 l2))) (should (memq 1 diff)) (should (memq 2 diff)) - (should (= (length diff) 2)) + (should (length= diff 2)) (should (equal l2 '(3 4 5 6)))) - (let* ((l1 (list "1" "2" "3" "4")) (l2 '("3" "4" "5" "6")) + (let* ((l1 (list "1" "2" "3" "4")) (l2 (list "3" "4" "5" "6")) (diff (cl-nset-difference l1 l2 :test #'equal))) (should (member "1" diff)) (should (member "2" diff)) - (should (= (length diff) 2)) + (should (length= diff 2)) (should (equal l2 '("3" "4" "5" "6")))) (let* ((l1 (list '(a . 1) '(b . 2) '(c . 3) '(d . 4))) (l2 (list '(c . 3) '(d . 4) '(e . 5) '(f . 6))) (diff (cl-nset-difference l1 l2 :key #'car))) (should (member '(a . 1) diff)) (should (member '(b . 2) diff)) - (should (= (length diff) 2))) + (should (length= diff 2)) + (should (equal l2 '((c . 3) (d . 4) (e . 5) (f . 6))))) (let* ((l1 (list '("a" . 1) '("b" . 2) '("c" . 3) '("d" . 4))) (l2 (list '("c" . 3) '("d" . 4) '("e" . 5) '("f" . 6))) (diff (cl-nset-difference l1 l2 :key #'car :test #'string=))) (should (member '("a" . 1) diff)) (should (member '("b" . 2) diff)) - (should (= (length diff) 2)))) + (should (length= diff 2)) + (should (equal l2 '(("c" . 3) ("d" . 4) ("e" . 5) ("f" . 6)))))) (ert-deftest cl-nset-difference-test () (should-not (cl-nset-difference () ())) (should-not (cl-nset-difference () (list 1 2 3))) - (should-not (cl-nset-difference (list 1 2 3) (list 1 2 3))) - (should-not (cl-nset-difference (list 1 2 3) (list 3 2 1) :test #'equal)) + (should-not (cl-nset-difference (list 1 2 3) '(1 2 3))) + (should-not (cl-nset-difference (list 1 2 3) '(3 2 1) :test #'equal)) (should (equal (cl-nset-difference (list 1 2 3) ()) '(1 2 3))) - (should (equal (cl-nset-difference (list 1 2 3 4) (list 3 4 5 6)) + (should (equal (cl-nset-difference (list 1 2 3 4) '(3 4 5 6)) '(1 2))) - (should (equal (cl-nset-difference (list 1 1 2 2 3) (list 3 4 5)) + (should (equal (cl-nset-difference (list 1 1 2 2 3) '(3 4 5)) '(1 1 2 2))) - (should (equal (cl-nset-difference (list 1 2 3) (list 3 2 4)) + (should (equal (cl-nset-difference (list 1 2 3) '(3 2 4)) '(1))) - (should (equal (cl-nset-difference (list 1 2 3 4 5) (list 3 4 5 6 7)) + (should (equal (cl-nset-difference (list 1 2 3 4 5) '(3 4 5 6 7)) '(1 2))) - (should (equal (cl-nset-difference (list 1 (copy-sequence "a")) (list 1 "a")) + (should (equal (cl-nset-difference (list 1 (copy-sequence "a")) '(1 "a")) '("a")))) (ert-deftest cl-set-exclusive-or-test () -- 2.47.2 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 76017) by debbugs.gnu.org; 2 Feb 2025 19:13:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 14:13:34 2025 Received: from localhost ([127.0.0.1]:36331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tefPS-0001HI-2J for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 14:13:34 -0500 Received: from mta-10-4.privateemail.com ([198.54.122.149]:43037) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <basil@HIDDEN>) id 1tefPP-0001Gn-Om for 76017 <at> debbugs.gnu.org; Sun, 02 Feb 2025 14:13:32 -0500 Received: from mta-10.privateemail.com (localhost [127.0.0.1]) by mta-10.privateemail.com (Postfix) with ESMTP id 4YmK6C6ZcTz3hhTl; Sun, 2 Feb 2025 14:13:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net; s=default; t=1738523603; bh=YbF+1SpjdizG0pHX8EBqRd7SC0rITHNPuXuZBeZh+j0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aL9Pl/8ToeeA544i7vIJK7+9TObc+SHrmoEEGiRINWOE3yAcWfQHuFb5S5cpdw42n Ut97ys53grDFLHUBtnLmbNnftsXe2sNPzDdbjOmyV7AJFhkO3PYpIojCkMJsy4bzNW Nt84hde3u6brS06AFD4izE57wB7a6KDttbO0mWPSi41NBqDjd/WNK0C8zI6FCxzrWD 2/YePAAKpx9MM6gRvVWHGcKtPpbeftLks3AM/lHS//Okn2D1Oyp/oESCsTq9oQMV96 U5JG+J64dwvl1CDxX2Mur8+T+XsfVy+BifWChVphoFwxCg9ceK83l0b9Qjog0EDccc SKEHxnhjLOfxg== Received: from localhost (unknown [31.46.243.74]) by mta-10.privateemail.com (Postfix) with ESMTPA; Sun, 2 Feb 2025 14:13:19 -0500 (EST) From: "Basil L. Contovounesios" <basil@HIDDEN> To: Pip Cet <pipcet@HIDDEN> Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? In-Reply-To: <87bjvk42t8.fsf@HIDDEN> (Pip Cet's message of "Sun, 02 Feb 2025 18:30:56 +0000") References: <87h65cgruv.fsf@HIDDEN> <87bjvk42t8.fsf@HIDDEN> Date: Sun, 02 Feb 2025 20:13:14 +0100 Message-ID: <87jza8p3cl.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 76017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Pip Cet [2025-02-02 18:30 +0000] wrote: > So no storage is ever reused, right? Right. > So is this about the optimizations that cl-nintersection might in theory > one day perform, but didn't do in 1993 and doesn't do today? Yes, but more importantly about fixing the inconsistent docs. >> - It is the weaker of the two requirements, thus backward-compatible. > > "weaker" in the sense that it gives the Lisp hacker more options, and > the Lisp implementor fewer options. I think we should go for "simpler": > assume both arguments may be mutated, and don't worry about specifying > them in the "right" order. It may be 'simpler' by some measure but it's also less backward-compatible. >> - Set difference implementations do not naturally benefit from modifying >> the second set (though I would love to see a counterexample). > > I'm not sure I agree. If you've got a cheap population count, you start > with the smaller set and throw out unnecessary elements, returning that > set. Not sure I understand how that works - could you give an example please? Given that set difference is not commutative, I don't immediately see how picking the smaller set can help. And since set difference is the complement of the second set wrt the first, I don't immediately see how any of the population (and thus storage) of the second set can survive the operation (i.e. be reused to greater effect than by reusing the first set's). >> - Callers of cl-nintersection having to ensure both arguments are safe >> to mutate (e.g. through excessive copying) could diminish any >> performance benefit it has over cl-intersection. > > Which is 0, right? Today it's actually worse than 0, since there's the funcall overhead in the absence of inlining. Hence 'any [potential] performance benefit'. Thanks, -- Basil
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Received: (at 76017) by debbugs.gnu.org; 2 Feb 2025 18:31:13 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 13:31:13 2025 Received: from localhost ([127.0.0.1]:36267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1teekT-0007hb-3M for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 13:31:13 -0500 Received: from mail-4322.protonmail.ch ([185.70.43.22]:44961) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>) id 1teekP-0007hH-0z for 76017 <at> debbugs.gnu.org; Sun, 02 Feb 2025 13:31:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738521062; x=1738780262; bh=eAW6C2iW2zc09pynPbqizWy926xxjmK6EFSbDlO4G28=; 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:List-Unsubscribe:List-Unsubscribe-Post; b=Rxrjf+sABmihvahzmF1/ViWBldmp3SfjG7A1eZALT6/KT+//HKdUR7c9F3MOlbUTZ TQaX5yEKtjcgtCcN8IATmWoqaP41wk9soDurr6nw+vyUd1itqfS8QebwtEw6FHu5r1 RnHq/0CgYa6WSaNwHc5l+s9HgxGXhE3dkpueKv2GUWgqEyOVsxCH/96L8xI/QRkOtu 2oOgE1cX5qQxjQ/EKlle+Ph1Cu3vRGP6NbTeDZwH6katpIG2rvNNC1UfhIF2oKN0vJ YmuoVmVmQUGoOIQEXi9shOp/SWnrOi/391dLCV9zSgPH0YPvJGec4JKkr9rThUqGRe YIdDmt81rwexQ== Date: Sun, 02 Feb 2025 18:30:56 +0000 To: "Basil L. Contovounesios" <basil@HIDDEN> From: Pip Cet <pipcet@HIDDEN> Subject: Re: bug#76017: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? Message-ID: <87bjvk42t8.fsf@HIDDEN> In-Reply-To: <87h65cgruv.fsf@HIDDEN> References: <87h65cgruv.fsf@HIDDEN> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: e49cb5d22982b6edc10b18c6ca1481d2b638c0bb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 76017 Cc: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, 76017 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) "Basil L. Contovounesios" <basil@HIDDEN> writes: > Since as far back as I can go in emacs.git history, the manual says: > > -- Function: cl-nintersection list1 list2 &key :test :test-not :key > This is a destructive version of =E2=80=98cl-intersection=E2=80= =99. It tries to > reuse storage of LIST1 rather than copying. It does _not_ reuse > the storage of LIST2. > whereas their docstrings say: > > (cl-nintersection LIST1 LIST2 [KEYWORD VALUE]...) > Combine LIST1 and LIST2 using a set-intersection operation. > The resulting list contains all items that appear in both LIST1 and LIST= 2. > This is a destructive function; it reuses the storage of LIST1 and LIST2 > whenever possible. On the third hand, the implementation is simply: (defun cl-nintersection (cl-list1 cl-list2 &rest cl-keys) "Combine LIST1 and LIST2 using a set-intersection operation. The resulting list contains all items that appear in both LIST1 and LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. \nKeywords supported: :test :test-not :key \n(fn LIST1 LIST2 [KEYWORD VALUE]...)" (and cl-list1 cl-list2 (apply 'cl-intersection cl-list1 cl-list2 cl-keys)= )) So no storage is ever reused, right? So is this about the optimizations that cl-nintersection might in theory one day perform, but didn't do in 1993 and doesn't do today? Or am I missing something there? I think the situation is similar to plist-put: you're taught always to reassign the return value to the variable you're using, but it only ever actually changes if the original list was nil. We reserve the right to switch to an optimized version but, so far, there was no need to. > My arguments in favour of the manual: > - Documented for decades in both Emacs and CL docs. > - It is the weaker of the two requirements, thus backward-compatible. "weaker" in the sense that it gives the Lisp hacker more options, and the Lisp implementor fewer options. I think we should go for "simpler": assume both arguments may be mutated, and don't worry about specifying them in the "right" order. > - Set difference implementations do not naturally benefit from modifying > the second set (though I would love to see a counterexample). I'm not sure I agree. If you've got a cheap population count, you start with the smaller set and throw out unnecessary elements, returning that set. > - Callers of cl-nintersection having to ensure both arguments are safe > to mutate (e.g. through excessive copying) could diminish any > performance benefit it has over cl-intersection. Which is 0, right? > If there is agreement, I can follow up with a patch for our docs and > tests. Both the "tries to" and "whenever possible" seem simply incorrect to me, but the byte compiler warning can stay, IMHO. Pip
bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 2 Feb 2025 17:49:01 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 12:49:01 2025 Received: from localhost ([127.0.0.1]:36171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tee5d-0002X7-6X for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 12:49:01 -0500 Received: from lists.gnu.org ([2001:470:142::17]:37302) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <basil@HIDDEN>) id 1tee5Z-0002Wk-Tx for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 12:48:58 -0500 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 <basil@HIDDEN>) id 1tee5T-00056g-AT for bug-gnu-emacs@HIDDEN; Sun, 02 Feb 2025 12:48:51 -0500 Received: from mta-10-4.privateemail.com ([198.54.122.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <basil@HIDDEN>) id 1tee5R-0005I5-AS for bug-gnu-emacs@HIDDEN; Sun, 02 Feb 2025 12:48:51 -0500 Received: from mta-10.privateemail.com (localhost [127.0.0.1]) by mta-10.privateemail.com (Postfix) with ESMTP id 4YmHDZ3jbhz3hhTs for <bug-gnu-emacs@HIDDEN>; Sun, 2 Feb 2025 12:48:46 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=contovou.net; s=default; t=1738518526; bh=2IWkm+rwXWluDXemSbzrYsFcENUIuCX9ukfJoVZQrzw=; h=From:To:Subject:Date:From; b=sY1rgEbHzEinR47zMa1PvstENk1+tLJJA+2LeWuFe8EL3FV7rcMPrrFWt8Ik57wSE SQZ9m2j/a5SVE2wwKt3tFS6Sy5kM8tXdKr6tuuICHvN0eZLgsfyR2Smfy5ncUcfJuX NI+/9GxTZqGcXIADkHInOXI9OAYtf9/SOsnlfwyxhBZ+ttej7iKkz/nL4tsKThTN/i wlmMlRh+MDSIy1I8jBUJzGC8PE3xqlcYxL6/oCA7obvc2YKTwAJ/iUHx+Mhv0KBcyl Y75DeMdIxWg2q1FTL2Nbb26vktbOGNjAHOisuaJ+Vqgc5ldSj2AX0wdqYpuBauNWJj ubK34k7azH4YQ== Received: from localhost (unknown [31.46.243.74]) by mta-10.privateemail.com (Postfix) with ESMTPA for <bug-gnu-emacs@HIDDEN>; Sun, 2 Feb 2025 12:48:45 -0500 (EST) From: "Basil L. Contovounesios" <basil@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 31.0.50; Which args can cl-nintersection and cl-nset-difference mutate? X-Debbugs-Cc: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= <mattias.engdegard@HIDDEN>, Stefan Monnier <monnier@HIDDEN> Date: Sun, 02 Feb 2025 18:48:40 +0100 Message-ID: <87h65cgruv.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV using ClamSMTP Received-SPF: pass client-ip=198.54.122.149; envelope-from=basil@HIDDEN; helo=MTA-10-4.privateemail.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) Since as far back as I can go in emacs.git history, the manual says: -- Function: cl-nintersection list1 list2 &key :test :test-not :key This is a destructive version of =E2=80=98cl-intersection=E2=80=99. I= t tries to reuse storage of LIST1 rather than copying. It does _not_ reuse the storage of LIST2. -- Function: cl-nset-difference list1 list2 &key :test :test-not :key This is a destructive =E2=80=98cl-set-difference=E2=80=99, which will = try to reuse LIST1 if possible. whereas their docstrings say: (cl-nintersection LIST1 LIST2 [KEYWORD VALUE]...) Combine LIST1 and LIST2 using a set-intersection operation. The resulting list contains all items that appear in both LIST1 and LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. (cl-nset-difference LIST1 LIST2 [KEYWORD VALUE]...) Combine LIST1 and LIST2 using a set-difference operation. The resulting list contains all items that appear in LIST1 but not LIST2. This is a destructive function; it reuses the storage of LIST1 and LIST2 whenever possible. The mutates-arguments property added in Byte-compiler warning about mutation of constant values bfc07100d28 2023-05-13 11:53:25 +0200 https://git.sv.gnu.org/cgit/emacs.git/commit/?id=3Dbfc07100d28 agrees with the docstrings, but CL docs I found online, and Jo=C3=A3o's pat= ch in https://lists.gnu.org/r/emacs-devel/2023-11/msg00595.html agree with the manual. My arguments in favour of the manual: - Documented for decades in both Emacs and CL docs. - It is the weaker of the two requirements, thus backward-compatible. - Set difference implementations do not naturally benefit from modifying the second set (though I would love to see a counterexample). - Callers of cl-nintersection having to ensure both arguments are safe to mutate (e.g. through excessive copying) could diminish any performance benefit it has over cl-intersection. If there is agreement, I can follow up with a patch for our docs and tests. Thanks, --=20 Basil In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.2, Xaw3d scroll bars) of 2025-02-02 built on tais Repository revision: c91c591f0f0cc774647c32bdcf05bb3a9551e340 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101015 System Description: Debian GNU/Linux trixie/sid
"Basil L. Contovounesios" <basil@HIDDEN>
:mattias.engdegard@HIDDEN, monnier@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.mattias.engdegard@HIDDEN, monnier@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#76017
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.