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: [Patch] definitions in when, unless, do as well as in cond- and case-clauses Date: Thu, 03 Feb 2022 11:48:22 +0100 Message-ID: <7f58438c-f2fb-49b6-b7b0-22054fde6277@www.fastmail.com> References: 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="4655"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-4585-ga9d9773056-fm-20220113.001-ga9d97730 To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Feb 03 11:56:17 2022 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 1nFZmh-0000yv-CR for guile-devel@m.gmane-mx.org; Thu, 03 Feb 2022 11:56:17 +0100 Original-Received: from localhost ([::1]:54644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nFZmf-0007Se-Ur for guile-devel@m.gmane-mx.org; Thu, 03 Feb 2022 05:56:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFZfu-00084c-O4 for guile-devel@gnu.org; Thu, 03 Feb 2022 05:49:15 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:36841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nFZfo-0003Rp-HV for guile-devel@gnu.org; Thu, 03 Feb 2022 05:49:13 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id B32A85C0208 for ; Thu, 3 Feb 2022 05:48:43 -0500 (EST) Original-Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 03 Feb 2022 05:48:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veryfast.biz; h= cc:content-transfer-encoding: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=fm1; bh=Qo0ofVQxDIgGX8 of9lO1gu6GdA4sBG30OIZEIHjUl7I=; b=CxuLty75L220YjMbCUL2G8roVZ9EKk JZ4nKjNVhoPKI+NGRrLw9XrO/w0S9EM335XS8lCokBqxVk3gAaWPB57pdQi7x1o8 3FaCnk7ImhIGmooi/9eFLjMQUdBcWVG/U0qiarz6fEShrcY+347I5Aiq/m/8rCHW SK2nZxUyKMc37R7D10vNuB0ID2j7sTpNCwjbkD9ht6hYHF12gpmBktD7aq1Q7OSE NHyaX8V4zCtk9bIgvA4KJNr5fr1sqge19A7lg4oDukY4NYLWV9Crt8Bk6AR4SFCc O+XOmqfr7BzdZi7SFFXLYi0uX+BDe8wcbk2BAQnOAehNvWnUvpGuHv1g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date: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; bh=Qo0ofVQxDIgGX8of9lO1gu6GdA4sBG30OIZEIHjUl7I=; b=NgWNM6Wj T3Eg5ehtDzO/O4P/Qm74sSeWAMWS74XFAsluTqyvVKIRB98yWxs7kZKqtNJ/alix 7RSD4i6bp79Fp6fDmE5EJKjQxH662xoIuc3TLh67dOeAdMuShUhcaRrGELaOOWx+ VMvOY20fKDzzueHaFeXwAHqZeHCXR+6p+MzBLya33dz+pg64CpFl4RnKRfXBy3E/ GHTxEiazjCFZNoHot4Bzn6ZhfwpFYmAKzITFaY3Ui3djHsAUkHaQoFxGV58Vgoiu yUUzMJDuq7R3I6JfBWZw5K7ejOB2VNC0C0F3sGnf5sENyUAh6WmYaDQUUfwzEfPW VUcli1JtbFK7qQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrgeejgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpefnihhnuhhspgeujhpnrhhnshhtrghmuceolhhinhhushdr sghjohhrnhhsthgrmhesvhgvrhihfhgrshhtrdgsihiiqeenucggtffrrghtthgvrhhnpe etvdeuteehueektefhuddvjeelteffuedvvdeuudeiuedvtedtueehhedvjeeiffenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlihhnuhhsrd gsjhhorhhnshhtrghmsehvvghrhihfrghsthdrsghiii X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 6FABD1BC0072; Thu, 3 Feb 2022 05:48:43 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.28; envelope-from=linus.bjornstam@veryfast.biz; helo=out4-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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" Xref: news.gmane.io gmane.lisp.guile.devel:21065 Archived-At: Hi guys, It looks like a 3.0.8 might be happening. I am curious to know whether t= his (perhaps minus the do form) is considered something that the maintai= ners of guile could find interesting.=20 If subset compatibility of r6|7rs is desired, I could provide a patch fo= r those files as well so that they enforce the distinction between defin= ition and expression context. I myself find this a worthwhile patch since it has no drawbacks. a (let = () ...) without definitions does not start a new lexical context and run= s as fast as a begin, so there should be no performance regressions. It also removes the last bodies in guile forms that have a definition co= ntext, which may be confusing for beginners. I would say that the compatibility question with the enforcing cond of r= nrs is the only thing that needs proper addressing. Best Linus Bj=C3=B6rnstam On Wed, 16 Jun 2021, at 21:11, Linus Bj=C3=B6rnstam wrote: > Hi there! > > This patch updates some derived conditional forms (and do and and-let*= )=20 > to support definitions in expression context. Meaning it makes this=20 > valid code: > > (cond=20 > ((pred? arg)=20 > (define a (something arg)) > (when (error-case a) > (error "a is broken")) > (define b (something2 a)) > (when (=3D 3 *log-level*) > (display "logging something1 and 2 as successful")) > (define c (something3 b a)) > (when (odd? c) > (error "something went wrong in something3")) > c) > (else=20 > ;;chosen by fair dice roll. Guaranteed to be random > 4))) > > While awful, is sometimes what the world makes us do.=20 > > The change means cond, case, when and unless behaves like it does in=20 > racket. Do was below case, so I changed that as well, and will actuall= y=20 > become yet another way guile is superior to racket.=20 > > I did also change the documentation, but I learned english by watching=20 > Beverly Hills cop, so that might need some fine touches by a capable=20 > english speaker. > =20 > > Best regards > Linus Bj=C3=B6rnstam > Attachments: > * 0001-Allow-definitions-in-derived-conditional-forms.patch