From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: pure-fns in byte-opt.el Date: Wed, 26 Jul 2017 08:58:24 -0400 Message-ID: References: <20170725020650.GA12601@holos.localdomain> <7ef8e35a-d236-5158-f2eb-85f01da87a2e@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1501073950 13875 195.159.176.226 (26 Jul 2017 12:59:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Jul 2017 12:59:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 26 14:59:07 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daLu6-0003Sc-U1 for ged-emacs-devel@m.gmane.org; Wed, 26 Jul 2017 14:59:07 +0200 Original-Received: from localhost ([::1]:38071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daLuC-0004lS-Q5 for ged-emacs-devel@m.gmane.org; Wed, 26 Jul 2017 08:59:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daLte-0004k9-O0 for emacs-devel@gnu.org; Wed, 26 Jul 2017 08:58:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daLtb-0006sw-NN for emacs-devel@gnu.org; Wed, 26 Jul 2017 08:58:38 -0400 Original-Received: from [195.159.176.226] (port=44465 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daLtb-0006sC-Gq for emacs-devel@gnu.org; Wed, 26 Jul 2017 08:58:35 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1daLtR-0001Rv-42 for emacs-devel@gnu.org; Wed, 26 Jul 2017 14:58:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:sg04NHOOCalx49CmhaY+hzj2IJI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217036 Archived-At: > I see. That's not what I understood to be usually meant by "pure": > although both arguments are pointers to the same address in memory, > the contents of that address have been modified in the meantime. > In that sense, haven't the two calls to string-to-char been passed > different values (albeit stored in the same memory location)? If you think of Haskell types: string-to-char :: String -> IO Char and that's because in order to implement string-to-char, you need to use aref :: Array α -> Int -> IO α > In other words, I don't see your example as proving that > string-to-char is impure; instead, it just looks like a pure function > that's passed two different values. As a concrete example, is the > following a proof that string-to-syntax is impure? If so, it should be > removed from our list of pure functions :) There are different notions of purity, indeed. Which is why I replied to Andreas saying that just because string-to-char is not strictly speaking pure, I don't see why adding it to pure-fns would break anything. Stefan