GNU bug report logs - #21944
Error on ordering of define-record-type and define-public in a module is unhelpful - possible improvement?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Koz Ross <koz.ross@HIDDEN>; dated Tue, 17 Nov 2015 17:44:04 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 21944 <at> debbugs.gnu.org:


Received: (at 21944) by debbugs.gnu.org; 27 Jun 2016 21:22:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 27 17:22:51 2016
Received: from localhost ([127.0.0.1]:58543 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bHdzX-0003cs-7P
	for submit <at> debbugs.gnu.org; Mon, 27 Jun 2016 17:22:51 -0400
Received: from pb-sasl2.pobox.com ([64.147.108.67]:54309
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bHdzV-0003cj-B9
 for 21944 <at> debbugs.gnu.org; Mon, 27 Jun 2016 17:22:49 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id AC88C25F18;
 Mon, 27 Jun 2016 17:22:47 -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; s=sasl; bh=fu9Dkf1XVh/7VOMknEegNZdksHY=; b=JUx8oP
 +3iMh88SjoMzS4Jtgi/6I36YQ5PmPkkeYyAhqsyeM4ATbTY5Zq8kvA25NeLUS04s
 mi4N3JGf4fu6Z1qFIxQhih4mOPwU3hFRkh3TYZSHZNQbsoy3ZfR/ljkTtocxK5vY
 RRnXndBApn2gP72RlN8CCcJQBvo+ltkumyvbc=
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; q=dns; s=sasl; b=TI6CenjLqmmSXDK11WuVHklHUw6w1jtL
 vfLOxN4NXN0trctjFuMZwUnochRuoIIenYTcO1fq2b1tFiA2/yCMn2Qf9eJ1HJdp
 5KwlDFr4eD1PkJlIVRxY34y3L2SOn0aGPef6n7lRShnn1uDbek9LBZFzR11fA/y/
 cn53WVeCCCg=
Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 8FE3F25F15;
 Mon, 27 Jun 2016 17:22:47 -0400 (EDT)
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 3F19B25F14;
 Mon, 27 Jun 2016 17:22:41 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#21944: Error on ordering of define-record-type and
 define-public in a module is unhelpful - possible improvement?
References: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
 <871t3jbqxj.fsf@HIDDEN> <874m8f9i02.fsf@HIDDEN>
 <87eg7ia9zz.fsf@HIDDEN>
Date: Mon, 27 Jun 2016 23:22:29 +0200
In-Reply-To: <87eg7ia9zz.fsf@HIDDEN> (Mark H. Weaver's message of "Mon, 27
 Jun 2016 12:10:08 -0400")
Message-ID: <87eg7i8gyy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 47F471D0-3CAD-11E6-A4CC-28A6F1301B6D-02397024!pb-sasl2.pobox.com
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 21944
Cc: ludo@HIDDEN, Koz Ross <koz.ross@HIDDEN>, 21944 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

On Mon 27 Jun 2016 18:10, Mark H Weaver <mhw@HIDDEN> writes:

>>   * if evaluating an expression throws an error, primitive-load doesn't
>>     read the following expressions and so doesn't detect syntax errors;
>>     try a file like this:
>>
>>     (error "what")
>>     )
>>
>>     With the interpreter (primitive-load) you will get the "what" error,
>>     not a syntax error.  (Yes the unclosed paren hurts my eyeballs but I
>>     wanted to demonstrate a syntax error.  Here's a matching paren:
>>     ")".)
>>
>>   * Procedural macros won't be able to use bindings defined previously
>>     in the file unless they are eval-whenned.  Of course this already
>>     breaks in the compiler, but it succeeds in the interpreter.
>
> Another problem is that in several places, we assume that if a top-level
> form calls 'set-current-module', the forms that follow in the file will
> now be expanded within that new module.  This behavior is needed for
> 'define-module' to work properly, and it's also assumed in boot-9.scm,
> psyntax-pp.scm, and maybe some other places.

I think I fixed this in a reasonable way in master; or, reasonable given
the historical mess that this all is anyway :) Your thoughts welcome
here.

If I did manage to fix that, then the remaining problems are the ones
that I mention, plus reader options which I mentioned in another mail.
I think probably reader options are the only significant issue.  WDYT?

Andy




Information forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.

Message received at 21944 <at> debbugs.gnu.org:


Received: (at 21944) by debbugs.gnu.org; 27 Jun 2016 16:10:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 27 12:10:31 2016
Received: from localhost ([127.0.0.1]:58436 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bHZ7H-0008Ii-My
	for submit <at> debbugs.gnu.org; Mon, 27 Jun 2016 12:10:31 -0400
Received: from world.peace.net ([50.252.239.5]:34675)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1bHZ7E-0008IP-US
 for 21944 <at> debbugs.gnu.org; Mon, 27 Jun 2016 12:10:29 -0400
Received: from pool-71-174-35-80.bstnma.east.verizon.net ([71.174.35.80]
 helo=jojen)
 by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <mhw@HIDDEN>)
 id 1bHZ78-0003IM-KX; Mon, 27 Jun 2016 12:10:22 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#21944: Error on ordering of define-record-type and
 define-public in a module is unhelpful - possible improvement?
References: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
 <871t3jbqxj.fsf@HIDDEN> <874m8f9i02.fsf@HIDDEN>
Date: Mon, 27 Jun 2016 12:10:08 -0400
In-Reply-To: <874m8f9i02.fsf@HIDDEN> (Andy Wingo's message of "Mon, 27 Jun
 2016 10:02:37 +0200")
Message-ID: <87eg7ia9zz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21944
Cc: ludo@HIDDEN, Koz Ross <koz.ross@HIDDEN>, 21944 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Andy Wingo <wingo@HIDDEN> writes:

> On Sun 26 Jun 2016 23:06, Andy Wingo <wingo@HIDDEN> writes:
>
>> On Tue 17 Nov 2015 09:27, Koz Ross <koz.ross@HIDDEN> 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 <bar>
>>>   (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
>
> Apparently the reason this doesn't work in Guile right now is that the
> compiler currently reads and compiles one Scheme expression at a time,
> then stitches them together on the Tree-IL level.  Incidentally,
> `primitive-load' works in the same way for the interpreter: it reads and
> eval's single expressions in a loop.  We could change this to have Guile
> read the whole file and pass it all to the expander at once, within a
> `begin'.  This has some user-visible changes though:
>
>   * if evaluating an expression throws an error, primitive-load doesn't
>     read the following expressions and so doesn't detect syntax errors;
>     try a file like this:
>
>     (error "what")
>     )
>
>     With the interpreter (primitive-load) you will get the "what" error,
>     not a syntax error.  (Yes the unclosed paren hurts my eyeballs but I
>     wanted to demonstrate a syntax error.  Here's a matching paren:
>     ")".)
>
>   * Procedural macros won't be able to use bindings defined previously
>     in the file unless they are eval-whenned.  Of course this already
>     breaks in the compiler, but it succeeds in the interpreter.

Another problem is that in several places, we assume that if a top-level
form calls 'set-current-module', the forms that follow in the file will
now be expanded within that new module.  This behavior is needed for
'define-module' to work properly, and it's also assumed in boot-9.scm,
psyntax-pp.scm, and maybe some other places.

      Mark




Information forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.

Message received at 21944 <at> debbugs.gnu.org:


Received: (at 21944) by debbugs.gnu.org; 27 Jun 2016 08:33:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 27 04:33:10 2016
Received: from localhost ([127.0.0.1]:57452 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bHRyg-0000jI-1Z
	for submit <at> debbugs.gnu.org; Mon, 27 Jun 2016 04:33:10 -0400
Received: from pb-sasl1.pobox.com ([64.147.108.66]:52399
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bHRye-0000jB-Rv
 for 21944 <at> debbugs.gnu.org; Mon, 27 Jun 2016 04:33:09 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 99D882095B;
 Mon, 27 Jun 2016 04:33:07 -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; s=sasl; bh=UPckrCc6W9B7v1DtJHQKkqt98Vo=; b=DqQmX4
 dFD5yaE5ZB5iYqAKnk/XxEt9vfbW4XebXnyfl/52Z77RgELuiEVh/hzlv4r6/k8a
 fOHhVh/FoEYkGA92qHy12pCKGp/C61nEnskj941FlAsyJogtisEGnTSLWG1IXsra
 iIHhsGnwPzsfAvvFDlTw9qH836Pow+mYAvk+w=
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; q=dns; s=sasl; b=SFZnhEGOKs4EnZn1oMB8n64wHk5wMdcG
 NxMvDz9XRGR/6Ll4xqoNzWFea1ocuglNPe3BAGtUKVjm5l9cLRYyi3tqSjwirlwf
 xOktEDdEjl0nQ3TBu+p2f9+29MvESIqR15gx6LoFZZ3Tx1+DzaubACmE/K84vM+i
 tJDqGWhABf8=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 91EF72095A;
 Mon, 27 Jun 2016 04:33:07 -0400 (EDT)
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-sasl1.pobox.com (Postfix) with ESMTPSA id DBB8720959;
 Mon, 27 Jun 2016 04:33:06 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Koz Ross <koz.ross@HIDDEN>
Subject: Re: bug#21944: Error on ordering of define-record-type and
 define-public in a module is unhelpful - possible improvement?
References: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
 <871t3jbqxj.fsf@HIDDEN> <874m8f9i02.fsf@HIDDEN>
Date: Mon, 27 Jun 2016 10:32:59 +0200
In-Reply-To: <874m8f9i02.fsf@HIDDEN> (Andy Wingo's message of "Mon, 27 Jun
 2016 10:02:37 +0200")
Message-ID: <87inwv8210.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: C5C90452-3C41-11E6-A10E-C1836462E9F6-02397024!pb-sasl1.pobox.com
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 21944
Cc: ludo@HIDDEN, 21944 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Mon 27 Jun 2016 10:02, Andy Wingo <wingo@HIDDEN> writes:

> Apparently the reason this doesn't work in Guile right now is that the
> compiler currently reads and compiles one Scheme expression at a time,
> then stitches them together on the Tree-IL level.  Incidentally,
> `primitive-load' works in the same way for the interpreter: it reads and
> eval's single expressions in a loop.  We could change this to have Guile
> read the whole file and pass it all to the expander at once, within a
> `begin'.  This has some user-visible changes though:
>
>   * if evaluating an expression throws an error, primitive-load doesn't
>     read the following expressions and so doesn't detect syntax errors;
>     try a file like this:
>
>     (error "what")
>     )
>
>     With the interpreter (primitive-load) you will get the "what" error,
>     not a syntax error.  (Yes the unclosed paren hurts my eyeballs but I
>     wanted to demonstrate a syntax error.  Here's a matching paren:
>     ")".)
>
>   * Procedural macros won't be able to use bindings defined previously
>     in the file unless they are eval-whenned.  Of course this already
>     breaks in the compiler, but it succeeds in the interpreter.

Another user-visible change: changes to read-options would not take
effect in the same places.

Andy




Information forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.

Message received at 21944 <at> debbugs.gnu.org:


Received: (at 21944) by debbugs.gnu.org; 27 Jun 2016 08:02:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 27 04:02:48 2016
Received: from localhost ([127.0.0.1]:57438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bHRVH-0008HJ-Vx
	for submit <at> debbugs.gnu.org; Mon, 27 Jun 2016 04:02:48 -0400
Received: from pb-sasl1.pobox.com ([64.147.108.66]:51671
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1bHRVF-0008HA-Nw
 for 21944 <at> debbugs.gnu.org; Mon, 27 Jun 2016 04:02:46 -0400
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 55A0E204B5;
 Mon, 27 Jun 2016 04:02:45 -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; s=sasl; bh=XiiyRHQvNClhVoSu/RuYbn7fAlY=; b=ehOXfu
 L+zqHr47Tp2fydJIinHAimU2Dvmiv8cZZn+kT18e/XGtd/mnYEKfuOPlAA/Y3Cyx
 75KapFi/aaHUGXxEp7+LuUAhC76KpMPqaQAQ/8luaolbA2/wDXnYAWSSs5SvZAj6
 dCoGfNmIatgmaFY1qhO1DMuHXeH9ti9oaip4k=
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; q=dns; s=sasl; b=omussl3hElY0+4uqH3XCBfF87WxXNrzs
 vj/s5LKwTojEtoEN5Cp5vWKK8yBcrnTm/3aaBxuwFaDTWG+0se3JP66FAx675fH9
 F6r2F64hgpLl67dFQLqsVLii3SMUscAGYrFriNvR/wCAz2RxCnZSC/3mZX3AGoZM
 JNx0OTCe7cg=
Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl1.pobox.com (Postfix) with ESMTP id 4E917204B3;
 Mon, 27 Jun 2016 04:02:45 -0400 (EDT)
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-sasl1.pobox.com (Postfix) with ESMTPSA id 69467204B2;
 Mon, 27 Jun 2016 04:02:44 -0400 (EDT)
From: Andy Wingo <wingo@HIDDEN>
To: Koz Ross <koz.ross@HIDDEN>
Subject: Re: bug#21944: Error on ordering of define-record-type and
 define-public in a module is unhelpful - possible improvement?
References: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
 <871t3jbqxj.fsf@HIDDEN>
Date: Mon, 27 Jun 2016 10:02:37 +0200
In-Reply-To: <871t3jbqxj.fsf@HIDDEN> (Andy Wingo's message of "Sun, 26 Jun
 2016 23:06:48 +0200")
Message-ID: <874m8f9i02.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: 879B6D40-3C3D-11E6-9A14-C1836462E9F6-02397024!pb-sasl1.pobox.com
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 21944
Cc: mhw@HIDDEN, ludo@HIDDEN, 21944 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sun 26 Jun 2016 23:06, Andy Wingo <wingo@HIDDEN> writes:

> On Tue 17 Nov 2015 09:27, Koz Ross <koz.ross@HIDDEN> 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 <bar>
>>   (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

Apparently the reason this doesn't work in Guile right now is that the
compiler currently reads and compiles one Scheme expression at a time,
then stitches them together on the Tree-IL level.  Incidentally,
`primitive-load' works in the same way for the interpreter: it reads and
eval's single expressions in a loop.  We could change this to have Guile
read the whole file and pass it all to the expander at once, within a
`begin'.  This has some user-visible changes though:

  * if evaluating an expression throws an error, primitive-load doesn't
    read the following expressions and so doesn't detect syntax errors;
    try a file like this:

    (error "what")
    )

    With the interpreter (primitive-load) you will get the "what" error,
    not a syntax error.  (Yes the unclosed paren hurts my eyeballs but I
    wanted to demonstrate a syntax error.  Here's a matching paren:
    ")".)

  * Procedural macros won't be able to use bindings defined previously
    in the file unless they are eval-whenned.  Of course this already
    breaks in the compiler, but it succeeds in the interpreter.

Maybe now is a good time to do this though, in 2.2.  Ludovic, Mark:
thoughts?

Andy




Information forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.

Message received at 21944 <at> debbugs.gnu.org:


Received: (at 21944) by debbugs.gnu.org; 26 Jun 2016 21:07:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 26 17:07:05 2016
Received: from localhost ([127.0.0.1]:57088 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bHHGi-00056F-Vm
	for submit <at> debbugs.gnu.org; Sun, 26 Jun 2016 17:07:05 -0400
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 <wingo@HIDDEN>) id 1bHHGg-000566-I2
 for 21944 <at> debbugs.gnu.org; Sun, 26 Jun 2016 17:07:03 -0400
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=
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)
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)
From: Andy Wingo <wingo@HIDDEN>
To: Koz Ross <koz.ross@HIDDEN>
Subject: Re: bug#21944: Error on ordering of define-record-type and
 define-public in a module is unhelpful - possible improvement?
References: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
Date: Sun, 26 Jun 2016 23:06:48 +0200
In-Reply-To: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN> (Koz
 Ross's message of "Tue, 17 Nov 2015 21:27:13 +1300")
Message-ID: <871t3jbqxj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Pobox-Relay-ID: EA78FA56-3BE1-11E6-A10C-28A6F1301B6D-02397024!pb-sasl2.pobox.com
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 21944
Cc: 21944 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue 17 Nov 2015 09:27, Koz Ross <koz.ross@HIDDEN> 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 <bar>
>   (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 #<catch-closure fcac00>)
  In ice-9/boot-9.scm:
      704:2  4 (call-with-prompt _ _ #<procedure default-prompt-handle=E2=
=80=A6>)
  In ice-9/eval.scm:
      608:8  3 (_ #(#(#<directory (guile-user) fd1f30>)))
  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: #<syntax-transformer make-bar>

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




Information forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Nov 2015 17:43:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 17 12:43:35 2015
Received: from localhost ([127.0.0.1]:41982 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZykI2-0005i4-CK
	for submit <at> debbugs.gnu.org; Tue, 17 Nov 2015 12:43:35 -0500
Received: from eggs.gnu.org ([208.118.235.92]:41771)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybc4-0004rB-O9
 for submit <at> debbugs.gnu.org; Tue, 17 Nov 2015 03:27:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybc3-0001v7-Ch
 for submit <at> debbugs.gnu.org; Tue, 17 Nov 2015 03:27:40 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:45876)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybc3-0001v3-9m
 for submit <at> debbugs.gnu.org; Tue, 17 Nov 2015 03:27:39 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51773)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybc2-0007fE-2f
 for bug-guile@HIDDEN; Tue, 17 Nov 2015 03:27:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybbx-0001uS-7u
 for bug-guile@HIDDEN; Tue, 17 Nov 2015 03:27:38 -0500
Received: from aibo.runbox.com ([91.220.196.211]:58701)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybbx-0001tz-1K
 for bug-guile@HIDDEN; Tue, 17 Nov 2015 03:27:33 -0500
Received: from [10.9.9.206] (helo=mailfront02.runbox.com)
 by bars.runbox.com with esmtp (Exim 4.71)
 (envelope-from <koz.ross@HIDDEN>) id 1Zybbr-0007OC-GL
 for bug-guile@HIDDEN; Tue, 17 Nov 2015 09:27:27 +0100
Received: from [121.99.235.239] (helo=Emi)
 by mailfront02.runbox.com with esmtpsa (uid:845118 )
 (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) id 1Zybbo-00082G-Eb
 for bug-guile@HIDDEN; Tue, 17 Nov 2015 09:27:24 +0100
Date: Tue, 17 Nov 2015 21:27:13 +1300
From: Koz Ross <koz.ross@HIDDEN>
To: bug-guile@HIDDEN
Subject: Error on ordering of define-record-type and define-public in a
 module is unhelpful - possible improvement?
Message-Id: <20151117212713.48944f57195a04fd0a6c5d86@HIDDEN>
X-Mailer: Sylpheed 3.4.3 (GTK+ 2.24.28; x86_64-unknown-linux-gnu)
Mime-Version: 1.0
Content-Type: multipart/signed; protocol="application/pgp-signature";
 micalg="PGP-SHA256";
 boundary="Signature=_Tue__17_Nov_2015_21_27_13_+1300_q0EL2n7STj+eXrMj"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 17 Nov 2015 12:43:32 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

--Signature=_Tue__17_Nov_2015_21_27_13_+1300_q0EL2n7STj+eXrMj
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 <bar>
  (make-bar open)
  bar?
  (open bar-open set-bar-open!))

I then also have this script test-foo.scm in the same directory:

#!/usr/bin/guile \
-L .. -s
!#

(use-modules (koz foo))
(define corner-bar (make-empty-bar))
(display corner-bar)
(newline)

After chmodding and trying to run test-foo.scm (with autocompilation enable=
d), I get a pile of error messages. After some testing, I discovered that i=
f the order of definitions in foo.scm is inverted (i.e. the define-record-t=
ype comes first), this problem does not occur and the script works fine. Ho=
wever, the errors received are extremely unhelpful:

Backtrace:
In ice-9/boot-9.scm:
 157: 8 [catch #t #<catch-closure 92abc0> ...]
In unknown file:
   ?: 7 [apply-smob/1 #<catch-closure 92abc0>]
In ice-9/boot-9.scm:
  63: 6 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 5 [eval # #]
In ice-9/boot-9.scm:
2401: 4 [save-module-excursion #<procedure 947880 at ice-9/boot-9.scm:4045:=
3 ()>]
4052: 3 [#<procedure 947880 at ice-9/boot-9.scm:4045:3 ()>]
In unknown file:
   ?: 2 [load-compiled/vm "/home/koz/.cache/guile/ccache/2.0-LE-8-2.0/home/=
koz/documents/programming/guile/koz/foo-test.scm.go"]
In /home/koz/documents/programming/guile/koz/./foo-test.scm:
   7: 1 [#<procedure d4a200 ()>]
In unknown file:
   ?: 0 [#<syntax-transformer make-empty-bar> #f 6 #f]

ERROR: In procedure #<syntax-transformer make-empty-bar>:
ERROR: Wrong type to apply: #<syntax-transformer make-empty-bar>

Would it be possible for the error message in this case to be a bit more he=
lpful? Even better, would it be possible to not make this an issue when com=
piling?
--=20
Koz Ross <koz.ross@HIDDEN>
www.retro-freedom.nz
If you aren't using GPG, you should be! https://emailselfdefense.fsf.org/en.
***
Please don't send me Word or PowerPoint attachments. See http://www.gnu.org=
/philosophy/no-word-attachments.html for why.
***
Proud member of the Open Wireless Movement. Find out more at https://openwi=
reless.org/

--Signature=_Tue__17_Nov_2015_21_27_13_+1300_q0EL2n7STj+eXrMj
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWSuThAAoJEJARVr/lAw1A8YQH+gO15lcRA1DfkAe6Km3YY2FE
kyIEC2kKDMSR+zzDVOBOs9rmEs4HOVX0uxOieqPo/ABtd1C/SLayvycdVwzCcDV2
uR29eIneMEO1SYGMBt3F9TpxH2DFZyoPi9xjCXgHx7vhPS9PLZDgaJjcCWxfSp9A
/c7kyC8TAO5TDMw8QYNG0cdZqzrlcf/10ZOzsGtfh2vGUQ2PQjA5kn2VHdkC/yUk
zGu3oK/N7OyPGXGKex0RCGi6PJX6KVLuh9XI2NPBbvt776g+NhjSN+mieTfIZTMe
hDOVTKsjmVdA37OCacRmc8kGm7wejwGPkzInGZscQ5hA3s71G/JAPn2CatTG8BQ=
=Xa/z
-----END PGP SIGNATURE-----

--Signature=_Tue__17_Nov_2015_21_27_13_+1300_q0EL2n7STj+eXrMj--




Acknowledgement sent to Koz Ross <koz.ross@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#21944; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.