latest fix for 'begin' causes error

Bug #456473 reported by leppie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ikarus Scheme
New
Undecided
Unassigned
Scheme Libraries
Invalid
Undecided
Derick Eddington

Bug Description

Hi

I just applied the latest version of psyntax to IronScheme.

Now, when running the R6RS testsuite, I get:

Unhandled exception during evaluation:
&who: list
&message: "raw symbol encountered in output of macro"
&syntax:
  form: (list 'quasiquote (list 'foo (cons 'unquote q)))
  subform: quasiquote

Any ideas? (not sure what is the cause yet)

Thanks

leppie

Related branches

Revision history for this message
leppie (leppie) wrote :

Same result in Ikarus:

$ ikarus --r6rs-script tests/r6rs/run.sps
Unhandled exception:
 Condition components:
   1. &who: list
   2. &message: "raw symbol encountered in output of macro"
   3. &syntax:
       form: (list 'quasiquote (list 'foo (cons 'unquote q)))
       subform: quasiquote

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 456473] Re: latest fix for 'begin' causes error

Can you at least send a sample code that shows the bug?

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

This was a bug in quasiquote that has been there for a long time and the bug fix just exposed it.
Fixed in 1865. Thanks.

Revision history for this message
leppie (leppie) wrote :

> Can you at least send a sample code that shows the bug?
>
>
Sorry. The code is from the PLT R6RS testsuite (from the base test IIRC).

Cheers

leppie

Revision history for this message
leppie (leppie) wrote :

Quasiquote issue now gone :)

Still an issue :(

$ ikarus --r6rs-script srfi/tests/multi-dimensional-arrays.sps
Unhandled exception:
 Condition components:
   1. &who: begin
   2. &message: "invalid syntax"
   3. &syntax:
       form: (begin)
       subform: #f
   4. &source-position:
       file-name: "srfi/tests/multi-dimensional-arrays.sps"
       character: 676
   5. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
   6. &trace: #<syntax (past)>

Not sure if it is Derrick's include code causing that, but it used to work. All the other SRFI use cases and tests works though.

Cheers

leppie

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

I don't know why that code overrides the definition of past, and commenting out the binding of past in the let-syntax makes it pass all tests. Forwarding to Derick.

Revision history for this message
leppie (leppie) wrote :

Thanks :)

Revision history for this message
Derick Eddington (derick-eddington) wrote :

On Wed, 2009-10-21 at 18:43 +0000, leppie wrote:
> $ ikarus --r6rs-script srfi/tests/multi-dimensional-arrays.sps
> Unhandled exception:
> Condition components:
> 1. &who: begin
> 2. &message: "invalid syntax"
> 3. &syntax:
> form: (begin)
> subform: #f
> 4. &source-position:
> file-name: "srfi/tests/multi-dimensional-arrays.sps"
> character: 676
> 5. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
> 6. &trace: #<syntax (past)>
>
> Not sure if it is Derrick's include code causing that, but it used to
> work. All the other SRFI use cases and tests works though.

On Wed, 2009-10-21 at 19:42 +0000, Abdulaziz Ghuloum wrote:
> I don't know why that code overrides the definition of past, and
> commenting out the binding of past in the let-syntax makes it pass all
> tests. Forwarding to Derick.

srfi/tests/multi-dimensional-arrays.sps uses its let-syntax to convert
the included code to use (srfi :78 lightweight-testing). That is done
instead of modifying the included file, so that the file remains
identical to the file released by the author, so that diffing or
patching it with updates from the author does not involve
not-originally-there content.

The purpose of the let-syntax binding of past is to make the included
uses of past disappear, because they are not relevant when the included
code is converted. The use of past is a hack so that, if a test fails
and calls error, using a debugger you can inspect the value returned by
(past) to know what "stones" the program went past to know what test
failed (bizarre, I know). The let-syntax-bound past transforms the uses
to (begin) to make them disappear.

The new issue is the empty (begin) forms. I think they are valid,
because top-level programs can have definitions and expressions
intermixed and so empty (begin) forms intermixed with expressions are
valid because they are valid definition forms. The following program
which does that works with Ikarus revision 1865 (and works with the
other R6RS systems):

$ cat top-level-begin.sps
#!r6rs
(import (rnrs))
(begin)
(define a 1)
(begin)
(define b 2)
(begin)
(display "one\n")
(begin)
(display "two\n")
(begin)
(display "three\n")
$ ikarus --r6rs-script top-level-begin.sps
one
two
three
$

So, if that program works, then so should the intermixed empty (begin)
forms in the expansion of srfi/tests/multi-dimensional-arrays.sps.

Revision history for this message
Derick Eddington (derick-eddington) wrote :

On Wed, 2009-10-21 at 16:33 -0700, Derick Eddington wrote:
> On Wed, 2009-10-21 at 18:43 +0000, leppie wrote:
> > 5. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
> > 6. &trace: #<syntax (past)>

> The new issue is the empty (begin) forms.

> So, if that program works, then so should the intermixed empty (begin)
> forms in the expansion of srfi/tests/multi-dimensional-arrays.sps.

Never mind. Top-level intermixed empty (begin) forms are not the
problem. The problem is the (past) expressions, in the definition of
tail, expanding into (begin) which is not a valid expression. Ikarus
wasn't catching this mistake of mine before.

Changed in scheme-libraries:
assignee: nobody → Derick Eddington (derick-eddington)
status: New → Invalid
Revision history for this message
Derick Eddington (derick-eddington) wrote :

I re-reported the bug in srfi/tests/multi-dimensional-arrays.sps as bug #457739.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.