From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: side effects, list sharing [was: `append' vs. `nconc'] Date: Thu, 31 Dec 2015 11:15:09 -0800 (PST) Message-ID: References: <568164D8.6050700@ojkastl.de> <87io3iyr7t.fsf@debian.uxu> <87si2kezg1.fsf@mithlond.arda> <87a8osrlj4.fsf_-_@debian.uxu> <87lh8bgafa.fsf@mithlond.arda> <87r3i3ch63.fsf@kuiper.lan.informatimago.com> <87si2jqee2.fsf@debian.uxu> <20151231093045.GB19900@tuxteam.de> <8760zev3xt.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1451589344 13733 80.91.229.3 (31 Dec 2015 19:15:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Dec 2015 19:15:44 +0000 (UTC) To: Emanuel Berg , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 31 20:15:31 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aEih7-0001iB-Qs for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2015 20:15:30 +0100 Original-Received: from localhost ([::1]:56608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEih6-0005vG-C3 for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Dec 2015 14:15:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEigu-0005vB-Ny for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 14:15:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEigr-0007nI-IC for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 14:15:16 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:45264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEigr-0007nE-C1 for help-gnu-emacs@gnu.org; Thu, 31 Dec 2015 14:15:13 -0500 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id tBVJFBHT010507 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 31 Dec 2015 19:15:12 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tBVJFAYQ018173 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 31 Dec 2015 19:15:11 GMT Original-Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id tBVJFAqg021862; Thu, 31 Dec 2015 19:15:10 GMT In-Reply-To: <8760zev3xt.fsf@debian.uxu> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108559 Archived-At: > But other then time/space optimization, what would you > say is the reason not to play it safe/sane and just > return stuff, new stuff if necessary, but instead > modify them directly? You will know it if you see it or when you really need it! If you don't see a need for sharing list structure then playing it safe/sane is the right approach. If you are modifying someone else's code, and you see structure-modifying code, that is, code that indicates that list-sharing is going on, then you need to wake up and take that into consideration. Otherwise, there is no need to worry about it - just play it safe/sane and Bob's your uncle. If you just want to learn about such use cases, look through existing Lisp code for uses of `setcar' and company. I can almost guarantee that they are not used gratuitously. And unless you see them used in a clearly local and safe/encapsulated fashion, look around for what's really going on, to see why that code uses list-sharing.