From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: pure-fns in byte-opt.el Date: Sat, 25 Jul 2020 21:53:14 +0200 Message-ID: References: <20170725020650.GA12601@holos.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17348"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Richard Stallman , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 25 21:54:03 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jzQF9-0004QL-0M for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 21:54:03 +0200 Original-Received: from localhost ([::1]:40354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzQF7-00008V-ST for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 15:54:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzQEb-0008A2-JX for emacs-devel@gnu.org; Sat, 25 Jul 2020 15:53:29 -0400 Original-Received: from mail-oo1-xc30.google.com ([2607:f8b0:4864:20::c30]:37593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzQEa-0005Ol-4B; Sat, 25 Jul 2020 15:53:29 -0400 Original-Received: by mail-oo1-xc30.google.com with SMTP id t6so2470763ooh.4; Sat, 25 Jul 2020 12:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uLt0AfUQiQSKCMx2XSDaf7Sjs786ZO7dMvuPoIpgVt8=; b=n0TA/G+d8ncE1J0lgcUHQ45UfbrayaeWpas7JPQqy157Msxkw3jXWU6j5A5Zdep5kM 2qkOTo7PIYZm0R4oUn9AyMuaGS5/4CK0U8wFUw8yRKw7GQo15X+YGifADEkyGmu/Aigp 8xiq8EIx1Z2nR5gFbw4NPu901vQwQgAVN+D0mKpFdhU+D6zchpnO/+kH1ckqdV5C4gJD tTagS34DyLP6iDuAghIr2guT+VL75H2XFdpVo8eUSddUW5zc8+NBYa8M/2lhXhh5uaUl l8DwJtHceN1vveyswSwd9o/VWKvVrl4ebhD4AwTEwdEPfd89gk6TFEwJxPgg64P+C+Wu eJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uLt0AfUQiQSKCMx2XSDaf7Sjs786ZO7dMvuPoIpgVt8=; b=BfpkJty3QOvrr8mKwtZ3CwaoGZk6vqPbN1/4v+lnszG5BzQ//etEehbKFV5tSAuZAw p7EW94eP9imAPiwJn8evGIRZesy+TQIQVxDDoofX0otsDIkcmudQ2Q21cohT8JJzATIK lc0ZUjLjuqi4Jm+wdYdEP1xW8mvCcsNhWKvksC6UPJ+2RtFxYTfa1K4+xQaPe/HJnEv6 qN48r6xYEgN7iso6eHZjXbh7nCWMPG3CaBI0fMUW5+JftdpJ7O1RPmKlz49Z6DXVdcs3 HlZCv5fnK4rFPIrfIUlHtycuRvOyrsptHjJ1V9C2tFI93MyU4PCfqaVLrDcD3bpeb6aV bjRA== X-Gm-Message-State: AOAM533WmQZAp7y3Mk3j2SGoLOhGSKul98V1guWI3M+FxDg2VqaUe7mm MyzqzjuqofQJjlTl1ID5eyDskiBWtUwUwxtFjpg= X-Google-Smtp-Source: ABdhPJzyBCfKBGZHJONg9bSDs/wbgDZHzuB6WjWq+M8KRMr/zSdV2lRgKmgg/xNPZCqZw6zIni5Gh7j+HfNRfuEWlEM= X-Received: by 2002:a4a:9c0f:: with SMTP id y15mr14985912ooj.81.1595706806452; Sat, 25 Jul 2020 12:53:26 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::c30; envelope-from=p.stephani2@gmail.com; helo=mail-oo1-xc30.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253232 Archived-At: Am Di., 26. Sept. 2017 um 02:26 Uhr schrieb Stefan Monnier : > > >> pure: like side-effect-free but additionally, the function always > >> returns the same value when called with the same arguments, so the > >> compiler can precompute the call if it knows the arguments. > > It may be necessary to define "same" more precisely. > > Does it mean equal? eq? > > Both/neither? The compiler doesn't test it in any way (it only has the > known arguments, and no "others" to compare it with). I guess `equal` > is closer to what typically happens, but I don't think this precision is > of any use. The only *real* definition is the last part: "the compiler > can precompute the call if it knows the arguments" (where "can" should > probably be replaced with "may", actually). > That's not a very useful definition, though, or rather, not a definition at all, but a consequence of an as-yet hidden definition. It has to be possible to decide whether a function is pure by looking at its observable behavior and its definition. Otherwise, how are programmers to apply the "pure" and "side-effect-free" attributes to their functions? The behavior of the byte compiled needs to follow from the definition, not the other way round. (I know this thread is 3 years old, but the same topic has been discussed in another thread as well recently, so it's not resolved. yet)