Hi,

i have the following two files, one that only requires the other and
calls a macro and the other one that defines that macro:

=== main.rkt
#lang racket

(require "err.rkt")
(a)

=== err.rkt
#lang racket

(begin-for-syntax
 (struct s (arg) #:transparent)

 (define (fun arg)
   (printf "arg: ~a\n" arg)))

(define-syntax (a stx)
  (syntax-case stx ()
    [(_)
     (with-syntax ([v #`#,(s 123)])
       #'(begin
           (begin-for-syntax
            (fun v))))]))

(provide a)

When executing 'racket main.rkt' directly i get the expected output
arg: #(struct:s 123)
but when i try to call 'raco make main.rkt' instead, i get this strange
error:

arg: #(struct:s 123)
write: cannot marshal value that is embedded in compiled code
  value: (s 123)
  context...:
   /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:388:6
/home_local/hamm_to/racket/racket-5.3.0.16/collects/racket/private/more-scheme.rkt:151:2: call-with-break-parameterization
   /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:188:5
   /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:508:26
   /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:501:42
/home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:466:0: maybe-compile-zo /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:579:2: do-check
   /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/cm.rkt:653:4
/home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/commands/make.rkt:77:8: for-loop /home_local/hamm_to/racket/racket-5.3.0.16/collects/compiler/commands/make.rkt: [running body] /home_local/hamm_to/racket/racket-5.3.0.16/collects/raco/raco.rkt: [running body] /home_local/hamm_to/racket/racket-5.3.0.16/collects/raco/main.rkt: [running body]

I think i need a little help to understand what is happening here
and what i am doing wrong. I had expected that running and compiling
works on the same set of programs.

Thanks for any clarification.

Tobias



--
---------------------------------------------------------
Tobias Hammer
DLR / Institute of Robotics and Mechatronics
Tel.: 08153/28-1487
Mail: tobias.ham...@dlr.de
_________________________
 Racket Developers list:
 http://lists.racket-lang.org/dev

Reply via email to