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 22:08:36 +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="40800"; 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 22:09:32 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 1jzQU7-000AWp-Hn for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 22:09:31 +0200 Original-Received: from localhost ([::1]:49246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzQU6-0004hw-K9 for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Jul 2020 16:09:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzQTT-0003zN-MR for emacs-devel@gnu.org; Sat, 25 Jul 2020 16:08:51 -0400 Original-Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:42685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzQTS-0007Py-8e; Sat, 25 Jul 2020 16:08:51 -0400 Original-Received: by mail-oi1-x230.google.com with SMTP id t4so11047910oij.9; Sat, 25 Jul 2020 13:08:49 -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=mva0JMN1BqG/WQhFpjoSUTe1u4TD6aRSczmSf8kMkk4=; b=d41tbOYRkBKePYmESIAXka9hOrZ8Ki0VETb2RbYVPCDvo82j5+2Cs5a+G2L5n906dA hHq8XqCWSR8rjc+81zRj+PAZvivmAlSOGMz2EgYcBoc2+y1zBPo0QkH/HqXLy7wsipOl ueo1SZQew8qQcTp2VBXEZQZYhsdclTHeLDIevOSebleLEWkyZhzuZl62AgY712Q6ESep rRdDa2bRxZZv2qdLlBJywva798I5L7d7Woz+Q3NTu2IqpWlS98ULM9ng/7zcUKn5ceRp g69IGBR82uqN9LGDpSvSbsSSw4BEznmd0LClqibssm39HJOsPJo6qwNij0/krHCEEDmC Q0sw== 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=mva0JMN1BqG/WQhFpjoSUTe1u4TD6aRSczmSf8kMkk4=; b=SdmWk8nczuNS/TAR3BxvZXb0yJCnM964MUQxDxnkIMaZs3h2dtIyyaXhbuY1mIIF+A GChWkd6G9wwC0FhyG3Haozeh9stHTSUQvNPY3LsGQa+yZ9ClGBf9jgjJEy5uatelQQbt 2NYkolMLxv7+rc+62SXJ+UQqZ/nGGwtiVq2U1ALnAEm+oJ/PynOPq2OQ8YLRtQZVCCbk bhKKaTAis6WpUFsyIx3SyVmtFio7bQf+mv7VV3zPJWooCmBpDcVHRV84bZ+xK2dT5OOr VObeFPvFeltXzv1/KAJCDx14SmO1mU7rm0dpKzdjBZCCv0FCW49BhOe8BGqsmXeXOizt IILA== X-Gm-Message-State: AOAM532tc4YZwMBocyJ0/Q7mWEB9XRYNW9TEaq0zkmP9wwCIobbR8Os5 bnvFAoyDO87htJKwNo6Td9K8iP4E4Ct09U0oFmE= X-Google-Smtp-Source: ABdhPJyMi0jW/H80mlhheFSWpnvWAas03rtIAqkED/Uu+DQdYFH/A1KeGAHOkTifj47FJ4zddfVPytGx7OSRSCdxrwc= X-Received: by 2002:a05:6808:a8d:: with SMTP id q13mr13194278oij.9.1595707728746; Sat, 25 Jul 2020 13:08:48 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=p.stephani2@gmail.com; helo=mail-oi1-x230.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:253234 Archived-At: Am Sa., 25. Juli 2020 um 21:58 Uhr schrieb Stefan Monnier : > > >> 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. > > I don't see why you think so. It requires the user to know how the byte optimizer operates (or at least, how it can operate in theory). > > > It has to be possible to decide whether a function is pure by looking > > at its observable behavior and its definition. > > The above "definition" seems to allow that: based on looking at the code > you should be able to assess whether it's safe to allow the compiler (or > anything else for that matter) to precompute the call. I wouldn't know how that should be possible without knowing how the compiler operates (or what it "knows" or can know). > > > The behavior of the byte compiled needs to follow > > from the definition, not the other way round. > > I don't see how the above definition fails this constraint. > It relies on some (rather vague) terms about the compiler, such as "precompute" and "know". What if we change the compiler significantly so that it "knows" much more? Wouldn't that suddenly change the possible set of pure functions?