From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolf Ade Newsgroups: gmane.emacs.tangents Subject: Re: 2016-05-23 Emacs News Date: Fri, 10 Jun 2016 17:22:16 +0200 Organization: Me Message-ID: <87r3c5cbmf.fsf@linux-qg7d.fritz.box> References: <87lh30iv18.fsf@sachachua.com> <87bn39ewp6.fsf@linux-qg7d.fritz.box> <87twh1gwu8.fsf@members.fsf.org> <8737oldv21.fsf@linux-qg7d.fritz.box> <87shwlf8x6.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1465572197 30810 80.91.229.3 (10 Jun 2016 15:23:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jun 2016 15:23:17 +0000 (UTC) Cc: Marcin Borkowski To: emacs-tangents@gnu.org Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Fri Jun 10 17:23:09 2016 Return-path: Envelope-to: get-emacs-tangents@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 1bBOH2-0003jU-J0 for get-emacs-tangents@m.gmane.org; Fri, 10 Jun 2016 17:23:04 +0200 Original-Received: from localhost ([::1]:42533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBOH1-0001su-Nk for get-emacs-tangents@m.gmane.org; Fri, 10 Jun 2016 11:23:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBOGh-0001q1-WE for emacs-tangents@gnu.org; Fri, 10 Jun 2016 11:22:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBOGd-0006UH-Pn for emacs-tangents@gnu.org; Fri, 10 Jun 2016 11:22:42 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:34730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBOGd-0006UC-IY for emacs-tangents@gnu.org; Fri, 10 Jun 2016 11:22:39 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bBOGa-0003PB-1M for emacs-tangents@gnu.org; Fri, 10 Jun 2016 17:22:36 +0200 Original-Received: from p4ffbfc1c.dip0.t-ipconnect.de ([79.251.252.28]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Jun 2016 17:22:36 +0200 Original-Received: from rolf by p4ffbfc1c.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Jun 2016 17:22:36 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 69 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p4ffbfc1c.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:DkM47JCPQvYL5eBvisujRx3gp98= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-tangents@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Original-Sender: "Emacs-tangents" Xref: news.gmane.org gmane.emacs.tangents:134 Archived-At: Marcin Borkowski writes: > On 2016-06-10, at 15:37, Rolf Ade wrote: >> Nicolas Richard writes: >>> Rolf Ade writes: >>>> (That is: >>>> http://mbork.pl/2016-05-23_Literal_values_and_destructive_functions) >>>> >>>> Wait, what? >>>> [...] >>>> in *Messages*. Could someone please explain that to me? >>> >>> The article you're referring to explains just that. Is it somehow >>> unclear ? Quoting the article: >>> >>> | What’s going on? >>> | >>> | Well, the literal in the function definition was actually changed. (If >>> | you evaluate the defun form now, it will be redefined once again to >>> | the “correct” value.) If you don’t believe it, try this: M-: >>> | (symbol-function #'destructive-havoc), or even better, M-x >>> | pp-eval-expression RET (symbol-function #'destructive-havoc) RET and >>> | see for yourself. >> >> Well ..., sorry, yes, that explanation isn't clear to me. [...] > > It's not like `sort' changes the _function_. But the function contains > a _literal structure_ (like "a constant"), and it is remembered as > a "pointer" (conceptually, not necessarily in C sense). So when `sort' > changes the structure "pointed to" by its argument (and it gets the > "pointer" to the very same structure referred to by the function), it > looks like the function is changed. > > Is that better? (If yes, I'll amend the article.) Hrrrhmm ... this discussion forces me, to paint myself as blockhead, but no, it still feels I poke around in the dark with a long stick. I could accept, that '(1 3 2) defines some global "constant", that gets modified by the `sort' call. But if I then look at: (defun destructive-havoc1 () "Example of destructive havoc." (setq foo '(1 3 2)) (message "before sort, foo is: %s" foo) (sort foo #'<) (message "after sort, foo is: %s" foo)) (defun destructive-havoc2 () "Example of destructive havoc." (setq foo '(1 3 2)) (message "before sort, foo is: %s" foo) (sort foo #'<) (message "after sort, foo is: %s" foo)) Evalute both defuns. Then do M-: (destructive-havoc1), then M-: (destructive-havoc2), then look at the *Messages* buffer. I see before sort, foo is: (1 3 2) after sort, foo is: (1 2 3) before sort, foo is: (1 3 2) after sort, foo is: (1 2 3) So, ... '(1 3 2) defines some (defun local) "constant" ...? I'm still afraid, I miss completely some basic concept or syntax understanding.