From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#21944: Error on ordering of define-record-type and define-public in a module is unhelpful - possible improvement? Date: Sun, 26 Jun 2016 23:06:48 +0200 Message-ID: <871t3jbqxj.fsf@pobox.com> References: <20151117212713.48944f57195a04fd0a6c5d86@retro-freedom.nz> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466975308 17796 80.91.229.3 (26 Jun 2016 21:08:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Jun 2016 21:08:28 +0000 (UTC) Cc: 21944@debbugs.gnu.org To: Koz Ross Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Jun 26 23:08:15 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bHHHp-0003FF-QQ for guile-bugs@m.gmane.org; Sun, 26 Jun 2016 23:08:14 +0200 Original-Received: from localhost ([::1]:55264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHHHp-0004Wl-3u for guile-bugs@m.gmane.org; Sun, 26 Jun 2016 17:08:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHHHi-0004Vq-Sg for bug-guile@gnu.org; Sun, 26 Jun 2016 17:08:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHHHe-0000dx-R2 for bug-guile@gnu.org; Sun, 26 Jun 2016 17:08:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHHHe-0000dt-LR for bug-guile@gnu.org; Sun, 26 Jun 2016 17:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bHHHe-00057h-HK for bug-guile@gnu.org; Sun, 26 Jun 2016 17:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 26 Jun 2016 21:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21944 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 21944-submit@debbugs.gnu.org id=B21944.146697522519611 (code B ref 21944); Sun, 26 Jun 2016 21:08:02 +0000 Original-Received: (at 21944) by debbugs.gnu.org; 26 Jun 2016 21:07:05 +0000 Original-Received: from localhost ([127.0.0.1]:57088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHHGi-00056F-Vm for submit@debbugs.gnu.org; Sun, 26 Jun 2016 17:07:05 -0400 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:63579 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHHGg-000566-I2 for 21944@debbugs.gnu.org; Sun, 26 Jun 2016 17:07:03 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id D1E9E26324; Sun, 26 Jun 2016 17:06:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=fhC2RLpXV/Xt jf61D+pf+6wbN54=; b=JcUQZZES0pyAm+OTQlpzY6B7lSqs+T2laF95RDZGIqPe lECSswGMNOHvCUYzrBaMU25BRjKY0PRjW0i0brCpmJX5/m1Cx1251hqwnn9IIY8m a/8gjWw/itSkby2eRS1FLWjXNurtdpt0T58NFxSOI64k3rE7wB4SBTJPAzbcEfU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=ShS7Bt U/YIw9lwdvIRActj6MQ2xQtLA5kp3SoXmR7mjchzhsrISBr0X2WiI8PMGeDrzG7G kSYtNfca98ED28eFkjPKT9RwQFHOF3t3My+Ev7bPTyzHpnjz5jYsuIOb+3e2fROw pd2TxnaNqA5Rnih2dhjLbj/L3bQwUlF78WzGo= Original-Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id BA22B26322; Sun, 26 Jun 2016 17:06:58 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id AEB8A26320; Sun, 26 Jun 2016 17:06:56 -0400 (EDT) In-Reply-To: <20151117212713.48944f57195a04fd0a6c5d86@retro-freedom.nz> (Koz Ross's message of "Tue, 17 Nov 2015 21:27:13 +1300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: EA78FA56-3BE1-11E6-A10C-28A6F1301B6D-02397024!pb-sasl2.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8256 Archived-At: On Tue 17 Nov 2015 09:27, Koz Ross writes: > I have the following file, called foo.scm: > > (define-module (koz foo) > #:use-module (srfi srfi-9)) > > (define-public (make-empty-bar) > (make-bar #f)) > > (define-record-type > (make-bar open) > bar? > (open bar-open set-bar-open!)) > Would it be possible for the error message in this case to be a bit > more helpful? Even better, would it be possible to not make this an > issue when compiling? It would be possible to make the scope of make-bar be the whole file. In theory it should work I guess, given this news entry from 2.0.1: ** `begin' expands macros in its body before other expressions This enables support for programs like the following: (begin (define even? (lambda (x) (or (=3D x 0) (odd? (- x 1))))) (define-syntax odd? (syntax-rules () ((odd? x) (not (even? x))))) (even? 10)) And indeed if I try something at the REPL that uses `begin' I can't reproduce this sort of error. Hmmmm. Maybe this rings a bell with Mark. In the mean-time I added a warning: wingo@clucks:~/src/guile$ meta/guile --fresh-auto-compile /tmp/foo.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /tmp/foo.scm ;;; /tmp/foo.scm:4:2: warning: macro `make-bar' used before definition ;;; compiled /home/wingo/src/guile/cache/guile/ccache/2.2-LE-8-3.9/tmp/fo= o.scm.go Backtrace: 5 (apply-smob/1 #) In ice-9/boot-9.scm: 704:2 4 (call-with-prompt _ _ #) In ice-9/eval.scm: 608:8 3 (_ #(#(#))) In ice-9/boot-9.scm: 2325:4 2 (save-module-excursion _) 3829:12 1 (_) In unknown file: 0 (_ #f) ERROR: ERROR: Wrong type to apply: # OK the error is terrible, but at least the warning tells you why the later error is terrible. I haven't been able to backport it to 2.0 yet though. But maybe the warning is useless if we can fix the issue. Andy