[gambit-list] How to use define-syntax and cond-expand in one program?

Marc Feeley feeley at iro.umontreal.ca
Fri Jun 29 10:28:45 EDT 2012


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



More information about the Gambit-list mailing list