From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.devel Subject: Re: Inconsistency with expressions between definitions Date: Mon, 25 Sep 2023 14:48:56 +0200 Message-ID: <833458a8-2b58-4eb7-900e-90ba62e5e4e4@app.fastmail.com> References: <87o7hsujrk.fsf@web.de> <87fs33v9ft.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1848"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.9.0-alpha0-761-gece9e40c48-fm-20230913.001-gece9e40c Cc: guile-devel@gnu.org To: "Dr. Arne Babenhauserheide" Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Mon Sep 25 15:03:31 2023 Return-path: Envelope-to: guile-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 1qklFJ-0000BV-Ae for guile-devel@m.gmane-mx.org; Mon, 25 Sep 2023 15:03:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qkl1k-0006QC-9S; Mon, 25 Sep 2023 08:49:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qkl1i-0006Pu-S6 for guile-devel@gnu.org; Mon, 25 Sep 2023 08:49:26 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qkl1h-0000oY-1m for guile-devel@gnu.org; Mon, 25 Sep 2023 08:49:26 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A94E63200A27; Mon, 25 Sep 2023 08:49:19 -0400 (EDT) Original-Received: from imap51 ([10.202.2.101]) by compute2.internal (MEProxy); Mon, 25 Sep 2023 08:49:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1695646159; x=1695732559; bh=0Gip3If1NhWyKBt8k1UV2EW2a5INIQBvq7O A0yhGWCY=; b=eIieewFan9nvO/5mTGu1jnd7rmDZdvHk1nYtfGi5e2uDCbRxpA3 qTG9qAtvrDH71669ngUoTsScoNZsOtP8AlR+qhym6jhu7sJyKlzjJgV53XwZC3gk XEIDszSPMI3VlThiJxY2Os0JBk11iVqgQ1SP9kV0nod1FLeW08Mxun0a/ivJ4HW7 AujPdwgdJmaGLt/GQAw7SIm2Vf2/2VJBSR4VkFeGnZLSbLM2Qjk/aTAaQpbqxXaA /hrdg+t2Jmz9m/VJ1PdGWBWB14ULT9OwQzaM0BqQFSLwsle+QVy7TGhsYq177HXM ghQXeKaUG/gmp633Epm/kOHSIgsLkPNHNQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1695646159; x=1695732559; bh=0Gip3If1NhWyKBt8k1UV2EW2a5INIQBvq7O A0yhGWCY=; b=Spe+PFikjTqb3exxy8+XcqAuoUmXGsaBic+ojgXow5wkpY7Xjxd VhWFG4OQjhoqK/EDsxD+1hAXUOB+eqpyY3Hf0Y9FzAObgGY3MAC3d4dN6qwQ1M7+ lmIaqhOgbdVDVoRPdcmGVCWR08gxZ20l96Sr1lazRyBK7/oD9OkbX/JxsSD7BOac Zdeud5a4AuC6LcYizOKCVUUMFIaRcoX2xGdB6karIuGJfs0R6zktfG0iqRYB0NIN MrdXGzrQuyYS9DpBqlsjqJ3SFtMINd7AswmgkdzP+ywuu04BDSZ+BzqolqJEW9cx ODZOIrt8BpX+wfPbfHRm3OeoeH4F+YwZDDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudelgedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepnfhi nhhushcuuehjnphrnhhsthgrmhcuoehlihhnuhhsrdgsjhhorhhnshhtrghmsehfrghsth hmrghilhdrshgvqeenucggtffrrghtthgvrhhnpeelkeeiheehhfffhefhffduueehveel vdfgkeejiefhleejkeetgfelleffudehleenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehlihhnuhhsrdgsjhhorhhnshhtrghmsehfrghsthhm rghilhdrshgv X-ME-Proxy: Feedback-ID: ie8bb436e:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id DE785B6008F; Mon, 25 Sep 2023 08:49:18 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <87fs33v9ft.fsf@web.de> Received-SPF: pass client-ip=64.147.123.19; envelope-from=linus.bjornstam@fastmail.se; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21982 Archived-At: Hi again! I am not sure about letrec*, but this should really raise an error in r6= rs. You cannot reference a variable before it is assigned.=20 I said it "would work in racket" because I believe it uses the same algo= rithm for deciding when and how and where and how and when things are bo= und in letrec*. This should also be the case in chez, but chez displays = an error. Given I have found the chez is never wrong with regards to R6R= S we can say that guiles behaviour is not conformant with r6rs.=20 It is also inconsistent with regards to guiles manual, at least if the p= art on internal definitions is to be believed.=20 What I am saying is: congrats, you found a bug :) Sorry about confusing you. I was never really sure about letrec* behavio= ur, but you nerdsniped me and I spent some time reading the "fixing letr= ec (reloaded)" paper, and now things are more clear. --=20 Linus Bj=C3=B6rnstam On Sun, 24 Sep 2023, at 18:02, Dr. Arne Babenhauserheide wrote: > Hi, > > Linus Bj=C3=B6rnstam writes: > >> When you are not referencing x before defining y everything works as >> you want. There is no, so to say, temporal dependency on how the >> things are bound. When you introduce (display x) before actually >> defining y you force letrec* to bind x to the unspecified value, >> because display has side-effects and you don't move around >> side-effecting code. > > This is a technical explanation. It answers "how does this happen?" > (thank you for that!), but not "why is this the correct behavior?". > > The core problem I see: if you inject some logging code between the > defines, the behavior changes. > > I would expect that referencing a variable that can=E2=80=99t yet be u= sed in an > intermediate expression (between defines) would not cause a (potential= ly > subtle) behavior change, but would throw an error: variable used in > expression that depends on later define. > > Racket does not support defines using later defines at all: > > $ racket >> (define (using-later-variable) >> (define x y) >> (define y #t) >> x) >> (using-later-variable) > y: undefined; > cannot use before initialization > [,bt for context] > > Best wishes, > Arne > --=20 > Unpolitisch sein > hei=C3=9Ft politisch sein, > ohne es zu merken. > draketo.de > > Attachments: > * signature.asc