From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.bugs Subject: bug#46014: (define (thunk) (lambda (x) x)) should be a compile error? Date: Fri, 22 Jan 2021 17:29:18 +0100 Message-ID: <20210122162918.GA27617@tuxteam.de> References: <87h7nb3v0g.fsf@dismail.de> <87bldil7fo.fsf@elephly.net> <87eeie2gs1.fsf@dismail.de> <878s8mkjsk.fsf@elephly.net> <87o8hhyqo3.fsf@dismail.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19154"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: 46014@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Fri Jan 22 17:30:29 2021 Return-path: Envelope-to: guile-bugs@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 1l2zKP-0004qc-49 for guile-bugs@m.gmane-mx.org; Fri, 22 Jan 2021 17:30:29 +0100 Original-Received: from localhost ([::1]:33526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2zKN-0000Yj-Rd for guile-bugs@m.gmane-mx.org; Fri, 22 Jan 2021 11:30:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2zJz-0000YO-Io for bug-guile@gnu.org; Fri, 22 Jan 2021 11:30:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2zJz-0000pG-BZ for bug-guile@gnu.org; Fri, 22 Jan 2021 11:30:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l2zJz-0007DN-3p for bug-guile@gnu.org; Fri, 22 Jan 2021 11:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 22 Jan 2021 16:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46014 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161133297527680 (code B ref -1); Fri, 22 Jan 2021 16:30:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jan 2021 16:29:35 +0000 Original-Received: from localhost ([127.0.0.1]:32807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2zJW-0007CO-OH for submit@debbugs.gnu.org; Fri, 22 Jan 2021 11:29:35 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2zJT-0007CD-Ql for submit@debbugs.gnu.org; Fri, 22 Jan 2021 11:29:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2zJT-0000HB-2s for bug-guile@gnu.org; Fri, 22 Jan 2021 11:29:31 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:57043) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1l2zJP-0000Yq-4N for bug-guile@gnu.org; Fri, 22 Jan 2021 11:29:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=1qIs8smb+KuQFPBz2Qd3jv2Mdfeh7tub8dP4utIRKu0=; b=dxH2I3SnDUrmyVhiJMu1DmlNxGoEPOGraS/cCkks7WFmxINKYsiMX4rC7zzRHbBdobToG4fKLEfvh4UScgsa0/qAWyczCAMcWjLuN/heF6dq/vPslr9jEd3ayTJMjtvCh9lbTuvu6ftAOSDfp1SxwvNwg03eLzZ0O62p0IH+khnDfHA1tj4JMBNe0mpH/u7ZNRPuxmiNuCKnGokefjMtExxC3ntm2IUPY+0NPubKrCP2zDAz9//rgBag8eTF5kGvrIK7O6x8m8jIhwzheO6XPaUdZhia65w0rBU94lCJ4VJaJO8xRkQ+WKMpLANSiYt8jzpjO0UDTVSeJBmrErb62A==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1l2zJG-0007Iw-3e for bug-guile@gnu.org; Fri, 22 Jan 2021 17:29:18 +0100 Content-Disposition: inline In-Reply-To: <87o8hhyqo3.fsf@dismail.de> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9965 Archived-At: --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 22, 2021 at 09:47:24AM -0500, jbranso--- via Bug reports for GU= ILE, GNU's Ubiquitous Extension Language wrote: > Ricardo Wurmus writes: >=20 > > Hi Joshua, > > > >> When I look at > >> > >> #+BEGIN_SRC scheme > >> (define (thunk) > >> (lambda (x) > >> x)) > >> #+END_SRC > > > > [=E2=80=A6] > > > >> My thought is, this is clearly a mistake. This person needs to change > >> the above code. > > > > How is this clearly a mistake? The definition of =E2=80=9Cthunk=E2=80= =9D above is > > perfectly fine and also common. >=20 > Thanks again for responding. I'm still learning scheme, and it's cool > that this email chain has helped clarify some things. :) >=20 > Ahh. I see now that the proper way to call thunk is to do this: > ((thunk) "the") > $1 =3D "the" >=20 > I had assumed that every time one called thunk, it would result in a > runtime error. I did not realize that there was a way to properly call > thunk. Wow. Scheme is truly impressive. >=20 > Interestingly, I had wrongly assumed that >=20 > #+BEGIN_SRC scheme > (thunk "test\n") ;; I assumed program execution would stop here > (display "Hello World\n") > #+END_SRC >=20 > program execution would stop at (thunk "test\n"). But it actually > caries on with execution of the program: What happens is an "exception". It can be handled (then it's up to the exception handler to end the program or do something else). > #+BEGIN_SRC scheme > :5:0: warning: possibly wrong number of arguments to `thunk' > ice-9/boot-9.scm:1669:16: In procedure raise-exception: > Wrong number of arguments to # >=20 > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. > Hello World > #+END_SRC This is the REPL's exception handler talking to you. It's there to help you debug the problem. Were it a standalone program, it would have terminated right away. (note that I'm not the most appropriate person to explain such things, I can barely wrap my head around them :-) Cheers [1] https://www.gnu.org/software/guile/docs/master/guile.html/Exceptions.ht= ml - tom=C3=A1s --y0ulUmNC+osPPQO6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmAK/V4ACgkQBcgs9XrR2kbIxACePKWcPtVfmvitEMIdQnhQOmWI RoQAniSIEmjI/j6/5h+0xP1fHCe+56SW =JAdy -----END PGP SIGNATURE----- --y0ulUmNC+osPPQO6--