Hi all.
I debugged the following compilation problem (v. 4.6.6): I am using 'gsc -:s ' because I need define-syntax, but then cond-expand is not working correctly.
Any solutions?
Sven
Afficher les réponses par date
On 2012-06-29, at 4:25 AM, Sven Hartrumpf wrote:
Hi all.
I debugged the following compilation problem (v. 4.6.6): I am using 'gsc -:s ' because I need define-syntax, but then cond-expand is not working correctly.
Any solutions?
Sven
Can you give more details on the nature of the error. When I try a simple example it works :
% cat foo.scm (cond-expand (gambit (define x 111) (define-syntax swap! (lambda (stx) (syntax-case stx () ((_ a b) (syntax (let ((value a)) (set! a b) (set! b value)))))))) (else (define x 222)))
(define y 333)
(swap! x y)
(pp x) (pp y) % gsc -:s -expansion foo.scm Expansion:
(define x 111)
(if ('#<procedure #2 ##eq?> void '#<procedure #3 void>) #!void (void))
(define y 333)
(let ((%%value12 x)) (let ((begin-temp.0 (set! x y))) (set! y %%value12)))
(pp x)
(pp y)
% gsi foo 333 111
Hi.
Fri, 29 Jun 2012 10:28:45 -0400, feeley wrote:
Can you give more details on the nature of the error.
Sure. Here is a small (mostly) minimal example:
cat top.scm
(include "srfi1.scm") (define-cond-expand-feature srfi-1) (include "part.scm") (write (first '(a)))
cat srfi1.scm
(define (first l) (car l))
cat part.scm
(cond-expand ((not srfi-1) (define (first l) (car l))) (else))
gsc -:s top.scm
top.c: In function '___H__20_top_2e_o2': top.c:178:1: error: duplicate label '___L0_first' top.c:141:1: note: previous definition of '___L0_first' was here top.c:181:1: error: duplicate label '___L_first' top.c:144:1: note: previous definition of '___L_first' was here top.c:188:1: error: duplicate label '___L2_first' top.c:151:1: note: previous definition of '___L2_first' was here top.c:190:1: error: duplicate label '___L1_first' top.c:153:1: note: previous definition of '___L1_first' was here top.c:192:1: error: duplicate label '___L3_first' top.c:155:1: note: previous definition of '___L3_first' was here
Ciao Sven
The cond-expand macro is defined both in the Gambit runtime and in the syntax-case expander. The native Gambit version accesses the cond-expand feature list, but the syntax-case version does not (because it is implemented with syntax-rules, which can't execute code which accesses the cond-expand feature list).
The solution would be to rewrite the syntax-case version of cond-expand using the syntax-case form. If you are interested in doing this, the code is in lib/psyntax73.ss . You'll also need a syntax-case version of define-cond-expand-feature to avoid phasing problems.
Marc
On 2012-06-29, at 10:51 AM, Sven Hartrumpf wrote:
Hi.
Fri, 29 Jun 2012 10:28:45 -0400, feeley wrote:
Can you give more details on the nature of the error.
Sure. Here is a small (mostly) minimal example:
cat top.scm
(include "srfi1.scm") (define-cond-expand-feature srfi-1) (include "part.scm") (write (first '(a)))
cat srfi1.scm
(define (first l) (car l))
cat part.scm
(cond-expand ((not srfi-1) (define (first l) (car l))) (else))
gsc -:s top.scm
top.c: In function '___H__20_top_2e_o2': top.c:178:1: error: duplicate label '___L0_first' top.c:141:1: note: previous definition of '___L0_first' was here top.c:181:1: error: duplicate label '___L_first' top.c:144:1: note: previous definition of '___L_first' was here top.c:188:1: error: duplicate label '___L2_first' top.c:151:1: note: previous definition of '___L2_first' was here top.c:190:1: error: duplicate label '___L1_first' top.c:153:1: note: previous definition of '___L1_first' was here top.c:192:1: error: duplicate label '___L3_first' top.c:155:1: note: previous definition of '___L3_first' was here
Ciao Sven _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Hello Marc.
Fri, 29 Jun 2012 13:05:01 -0400, feeley wrote:
The cond-expand macro is defined both in the Gambit runtime and in the syntax-case expander. The native Gambit version accesses the cond-expand feature list, but the syntax-case version does not (because it is implemented with syntax-rules, which can't execute code which accesses the cond-expand feature list).
The solution would be to rewrite the syntax-case version of cond-expand using the syntax-case form. If you are interested in doing this, the code is in lib/psyntax73.ss .
I tried, see attached patch.
You'll also need a syntax-case version of define-cond-expand-feature to avoid phasing problems.
I am unsure how to fix this. Sorry.
Sven