From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jbranso--- via "Bug reports for GUILE, GNU's Ubiquitous Extension Language" Newsgroups: gmane.lisp.guile.bugs Subject: bug#46014: (define (thunk) (lambda (x) x)) should be a compile error? Date: Wed, 20 Jan 2021 21:04:47 -0500 Message-ID: <87h7nb3v0g.fsf@dismail.de> Reply-To: Joshua Branson Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32022"; mail-complaints-to="usenet@ciao.gmane.io" To: 46014@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Jan 21 03:05:18 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 1l2PLZ-0008C2-Ay for guile-bugs@m.gmane-mx.org; Thu, 21 Jan 2021 03:05:17 +0100 Original-Received: from localhost ([::1]:40290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2PLX-00042g-VQ for guile-bugs@m.gmane-mx.org; Wed, 20 Jan 2021 21:05:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2PLK-00042Y-97 for bug-guile@gnu.org; Wed, 20 Jan 2021 21:05:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44974) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2PLK-0001AF-1f for bug-guile@gnu.org; Wed, 20 Jan 2021 21:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l2PLJ-0000ho-R0 for bug-guile@gnu.org; Wed, 20 Jan 2021 21:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Joshua Branson Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 21 Jan 2021 02:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 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.16111946992695 (code B ref -1); Thu, 21 Jan 2021 02:05:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jan 2021 02:04:59 +0000 Original-Received: from localhost ([127.0.0.1]:56520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2PLG-0000hO-Ma for submit@debbugs.gnu.org; Wed, 20 Jan 2021 21:04:58 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2PLF-0000hH-AR for submit@debbugs.gnu.org; Wed, 20 Jan 2021 21:04:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2PLF-00042M-5C for bug-guile@gnu.org; Wed, 20 Jan 2021 21:04:57 -0500 Original-Received: from mx1.dismail.de ([78.46.223.134]:27723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2PLC-00013m-Ox for bug-guile@gnu.org; Wed, 20 Jan 2021 21:04:56 -0500 Original-Received: from mx1.dismail.de (localhost [127.0.0.1]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 5ce9cb46 for ; Thu, 21 Jan 2021 03:04:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=date :message-id:from:to:subject; s=20190914; bh=HO6/xWzGszXyVbAqRZs8 TmZPOhArujIKQSoE6ELZjk0=; b=UbwvdmqAeJJ3yKzG3rtvtq2RDULb3Q0cNQwU rmrX37Xqx1HubEu1jgLf5ZZ8B7wx4LGcI2q3Y2micQY8OP5iMLWf9bCYGqv+mikP HUo8HFH68snMVVfch6/6xhnDlSk/yqHU9Wnij7aWFEG7qwK4vh0x4UK//ehi0cu0 imx0zXH4xM4TZtlq6Y/bU2Wad0GzaK/XJufKXGM8WXl1ms8SI52+dEzhWnCSA0GT SG/HpWxFASC0cdOd6BjK9ly+8B+1hVTaasK6/MtnX6P32x/zn/chwWw7aodLosF/ iToJ0MXh/f90pAmgTY/hi6Q3YhoWvYIU2YsRAhlIGfQQNdLICg== Original-Received: from smtp2.dismail.de ( [10.240.26.12]) by mx1.dismail.de (OpenSMTPD) with ESMTP id 792dd728 for ; Thu, 21 Jan 2021 03:04:50 +0100 (CET) Original-Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id cd8e3961 for ; Thu, 21 Jan 2021 03:04:50 +0100 (CET) Original-Received: by dismail.de (OpenSMTPD) with ESMTPSA id 97ba64c1 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Thu, 21 Jan 2021 03:04:49 +0100 (CET) Received-SPF: pass client-ip=78.46.223.134; envelope-from=jbranso@dismail.de; helo=mx1.dismail.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, 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:9958 Archived-At: Hello! Consider this bit of simple code: #+BEGIN_SRC scheme (define (thunk) (lambda (x) x)) (thunk) ;; works ok, I guess. (thunk "hello world!\n") ;; runtime error ;;; :1074: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 # Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. #+END_SRC Guile will compile this program seemingly with no error. Guile will correctly report at runtime that procedure '(thunk "hello world!\n")' takes no arguments, but it's lambda accepts 1 argument. Would it be possible to report this error at compile time? Would that be advantageous? I personally can consider one time where reporting this error at compile time would be advantageous. Here's how I found out about this error. (would ya'll call this an error/bug/feature)? #+BEGIN_SRC scheme (use-modules (srfi srfi-9)) (define-record-type (make-lunch food duration location) lunch? (food lunch-food) (duration lunch-duration) (location lunch-location)) (define dine-out (make-lunch "pizza" "30 min" "downtown")) ;; maybe this should be a syntax error instead of a runtime error? (define (list-lunch) (match-lambda (($ food duration location ) (list food duration location)))) ;; this is the proper way to do it. (define list-lunch (match-lambda (($ food duration location ) (list food duration location)))) #+END_SRC I eventually discovered what the issue was, but I had to run the code to discover it. I don't know if this is a silly bug report. If it is, sorry for the noise. Thanks, Joshua P.S. Guile's error messages at compile time and runtime are super well written. Thanks!