Discussion:
[Larceny-users] error compiling cons form
Marco Maggi
2008-12-26 10:16:12 UTC
Permalink
On a i686-pc-linux-gnu running larceny-5877
compiled with:

(setup 'scheme: 'larceny
'host: 'linux86
'sassy 'string-rep: 'flat4)

I COMPILE-LIBRARY file with this chunk of
code:

(define deferred-exceptions
(make-parameter #f))

(define-syntax defer-exceptions
(syntax-rules ()
((_ ?form0 ?form ...)
(guard (exc (else
(when (deferred-exceptions)
(deferred-exceptions
(cons exc (deferred-exceptions))))))
?form0 ?form ...))))

Ypsilon and Ikarus run a test suite
for the library with no problems and
no failing tests.

Larceny gives me this error:

|Compiling uriel/lang.sls
|
|Error: no handler for exception #<record &compound-condition>
|Compound condition has these components:
|#<record &assertion>
|#<record &who>
| who : "car"
|#<record &message>
| message : " () is not a pair.\n"
|
|Terminating program execution.

but if I replace the form:

(cons exc (deferred-exceptions))

with:

(cons '(1 2) (deferred-exceptions))

compilation completes fine.

Posting the whole code is impossible,
if there is the need I can only give
you a distribution to download. But,
the following program compiles fine:

(import (rnrs))
(define-syntax defer-exceptions
(syntax-rules ()
((_ ?form0 ?form ...)
(guard (exc (else
(cons exc #t)))
?form0 ?form ...))))

and the MAKE-PARAMETER in the failing
library is the following SRFI-39
implementation:

(define make-this-parameter
(case-lambda
((value validator)
(let ((the-parm (make-parameter 'unnamed (validator value))))
(case-lambda
((value)
(the-parm (validator value)))
(()
(the-parm)))))
((value)
(make-this-parameter value (lambda (x) x)))))

which works with my test suite.

I really, really, really do not
want to know why compiling CONS
does this, just tell me if it is
a bug in the compiler and I have
to wait for a fix.
--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
Marco Maggi
2008-12-26 19:45:41 UTC
Permalink
The problem goes away if I do:

(define-syntax defer-exceptions
(syntax-rules ()
((_ ?form0 ?form ...)
(guard (exc (else
(let ((e (deferred-exceptions)))
(and e (deferred-exceptions (cons exc e))))))
?form0 ?form ...))))
Post by Marco Maggi
I really, really, really do not
want to know why compiling CONS
does this, just tell me if it is
a bug in the compiler and I have
to wait for a fix.
Sorry for the whining. :)
--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
Felix Klock
2008-12-26 20:03:54 UTC
Permalink
Marco (cc'ing larceny-users)-
Post by Marco Maggi
(define-syntax defer-exceptions
(syntax-rules ()
((_ ?form0 ?form ...)
(guard (exc (else
(let ((e (deferred-exceptions)))
(and e (deferred-exceptions (cons exc e))))))
?form0 ?form ...))))
I'm trying to reproduce your problem on a smaller test case (by taking
snippets from the source code at http://github.com/marcomaggi/nausicaa/tree/master/uriel/libraries/uriel/lang.sls
), but so far have failed to reproduce the compiler error.

Does the problem also go away if you get rid of the invocations of the
defer-exceptions macro? Is there a particular invocation that the
problem is strongly tied to? (I just want to confirm that this is a
problem dealing with the results of expansion, as opposed to the
definition of the defer-exceptions macro itself.)

-Felix
Felix Klock
2008-12-26 20:08:58 UTC
Permalink
Post by Felix Klock
Marco (cc'ing larceny-users)-
Post by Marco Maggi
(define-syntax defer-exceptions
(syntax-rules ()
((_ ?form0 ?form ...)
(guard (exc (else
(let ((e (deferred-exceptions)))
(and e (deferred-exceptions (cons exc e))))))
?form0 ?form ...))))
I'm trying to reproduce your problem on a smaller test case (by
taking snippets from the source code at http://github.com/marcomaggi/nausicaa/tree/master/uriel/libraries/uriel/lang.sls
), but so far have failed to reproduce the compiler error.
Never mind, I managed to reproduce the problem on a small test case.

I'll be filing a ticket about this shortly.

-Felix
Felix Klock
2008-12-26 20:31:49 UTC
Permalink
Marco (cc'ing larceny-users)-
Post by Felix Klock
I'll be filing a ticket about this shortly.
If you want to follow progress on this, I filed it as ticket #600 :

https://trac.ccs.neu.edu/trac/larceny/ticket/600

I will spend a bit more time trying to reduce it a bit more, but right
now it seems like all of those components (the guard, the cond, the
variable-arity procedure, etc) are necessary to reproduce the
problem. Quite odd.

As for actually fixing the problem, that may have to wait until Will
gets a chance to look at it, unless I reduce it down to something
really trivial to analyze...

-Felix
Felix Klock
2008-12-26 21:40:47 UTC
Permalink
Marco (cc'ing larceny-users)-
Post by Marco Maggi
Post by Marco Maggi
I really, really, really do not
want to know why compiling CONS
does this, just tell me if it is
a bug in the compiler and I have
to wait for a fix.
Sorry for the whining. :)
It is a bug in the compiler. You have to wait for a fix.

I'll be checking one in very soon. :)

-Felix

p.s. people who *do* want to know why this was happening can read
about it in Ticket #600. I put a pretty complete description there of
the process I followed to track it down. :)
William D Clinger
2008-12-26 21:44:56 UTC
Permalink
Ticket #600 is fixed as of changeset:5880.

I didn't realize that Felix was working on the problem,
so I tracked it down independently.

Will

Continue reading on narkive:
Loading...