From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.tangents Subject: Re: 2016-05-23 Emacs News Date: Fri, 10 Jun 2016 09:45:42 -0700 Message-ID: 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> <87r3c5cbmf.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1465577611 23082 80.91.229.3 (10 Jun 2016 16:53:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jun 2016 16:53:31 +0000 (UTC) Cc: Rolf Ade , Marcin Borkowski To: emacs-tangents@gnu.org Original-X-From: emacs-tangents-bounces+get-emacs-tangents=m.gmane.org@gnu.org Fri Jun 10 18:53:31 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 1bBPgX-0004R5-SR for get-emacs-tangents@m.gmane.org; Fri, 10 Jun 2016 18:53:30 +0200 Original-Received: from localhost ([::1]:43437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBPgT-0007vx-ME for get-emacs-tangents@m.gmane.org; Fri, 10 Jun 2016 12:53:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBPZM-0002JP-61 for emacs-tangents@gnu.org; Fri, 10 Jun 2016 12:46:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBPZK-00046P-63 for emacs-tangents@gnu.org; Fri, 10 Jun 2016 12:46:03 -0400 Original-Received: from mail-yw0-x230.google.com ([2607:f8b0:4002:c05::230]:36025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBPZK-00046K-22 for emacs-tangents@gnu.org; Fri, 10 Jun 2016 12:46:02 -0400 Original-Received: by mail-yw0-x230.google.com with SMTP id x189so71626290ywe.3 for ; Fri, 10 Jun 2016 09:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=q4cTm5F2uyOOKlaAdBjsRCmgv43AejrZTN7k7Kggeto=; b=zbruF24hkW/f+++9f8f2kOAQxlUprLgw2fxNfTfWAJUukw3EixXK8qj4YPDpZZxo6y NzObUHOzy/NLx7mMLlR83uYfbmXCXt7m25zo5yf56CC3hMLHMoTgm5YdbnLUPfufWV+n IWn/WgD7QnWIMYW65AeUlpDpuD4RToYOBRoh4iPyM+hL3hF4qg4X26U0TC8V9v9L7JSo hFSFUEUNeQOcn4zcocMGMuKBlROuBZyGrDV0Js68mQiVQ2p4rbestkVrE3lvFSWal2nH ZsTln/4ovMCxq/TDT/+ss9BPARm0DtgHbW9+AgqFyJMObn8i2kz3q/z2LnQMg249nfD3 lJlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=q4cTm5F2uyOOKlaAdBjsRCmgv43AejrZTN7k7Kggeto=; b=fHjdZ7hUSp9OwiqAw+uBd+rF1KGx5asDtVqfJ3HyyTP6JLnA+NMXenY43c+0P6le6y wkkrLAUK9XGJYc4aLn7+s9eZmuTqSj2rYdwRg3BysF9Hjo8oG9AYtcyRHJ6AXTI3B5Tp FzhYGs/THelWqVlqhkDcJDXC8+A9XbAn4bLj5bll57sfucJEb7/jx05+09eUmYxaH3lt 1F7zNZSj2X2irtxVTOdgJlLhmlZHvpX3oeU4ulrMbklIOO70OEbS+au60Y7iDE1rZChP 2GsT+cmFf1/F6QekNBA0RAC492AAUdU59kPaVzo7Bc22/CzzJ9szony0clL/UqLJd4EF maCw== X-Gm-Message-State: ALyK8tKpHIBnww5nR2RvyRj+QivBrovyJMkLNIr2PhEX+JhgLegWClVffPqP+kv0t3DLFnIIxtmnOSSV2g21Uw== X-Received: by 10.13.198.197 with SMTP id i188mr1536943ywd.207.1465577161639; Fri, 10 Jun 2016 09:46:01 -0700 (PDT) Original-Received: by 10.37.98.136 with HTTP; Fri, 10 Jun 2016 09:45:42 -0700 (PDT) In-Reply-To: <87r3c5cbmf.fsf@linux-qg7d.fritz.box> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::230 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:136 Archived-At: Rolf Ade wrote: > So, ... '(1 3 2) defines some (defun local) "constant" ...? > > I'm still afraid, I miss completely some basic concept or syntax > understanding. That's right, though the fact that it's "defun local" is an implementation detail. It could hypothetically be module/package local, or global, etc. with a different implementation and compilation strategy. (Also, I think "literal" is a better word for this than "constant".) The reason it's defun local in Emacs lisp is that each function object (whether byte-compiled or not) contains the literals from that function's definition. It might (or might not) be more clear if you try this, which is essentially the same as Marcin's recipe but we byte-compile the function. You'll see that the list is stored in an vector of the literals in the definition (in this case, the quoted list, symbols, and strings). The reason I think this might help is that it makes it more clear that the function itself is an object containing data. (defun destructive-havoc () (let ((foo '(1 3 2))) (message "before sort: %s" foo) (sort foo #'<) (message "after sort: %s" foo))) (byte-compile 'destructive-havoc) (pp-eval-expression '(symbol-function 'destructive-havoc)) (destructive-havoc) (pp-eval-expression '(symbol-function 'destructive-havoc)) So, when you call `destructive-havoc', the call to `sort' is acting on the list in that vector. That vector and its contents are part of the function object for `destructive-havoc', so mutations to them are permanent (relative to the function object itself). Hope that helps, John