[racket-dev] raco make cannot marshal value error

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Fri Jul 27 05:35:13 EDT 2012

Thanks for the explanation. I think i understand now what i did wrong.
The 3D syntax was a good hint for further reading. I digged up a thread*
where you already had to explain it 10 years ago :)

Tobias

* http://www.cs.utah.edu/plt/mailarch/plt-scheme-2002/msg00111.html


On Thu, 26 Jul 2012 15:36:44 +0200, Matthew Flatt <mflatt at cs.utah.edu>  
wrote:

> I agree that it's a bug, in a sense, that your program runs even though
> it cannot be compiled.
>
> This is an example of "3-D syntax": you're embedding a value (i.e., an
> instance of `s') that you can't write as a literal into the result of a
> macro expansion. I think 3-D syntax probably should not be allowed, but
> the macro system currently allows it.
>
> Most likely, using 3-D syntax is a bad idea. It's possible that you
> want to replace `#:transparent' with `#:prefab' in your example, since
> a prefab structure can be written as a literal. More likely, I think
> you want to generate an expression that constructs an `s' instead of
> generating an `s' instance in the macro expansion.
>
> At Thu, 26 Jul 2012 14:59:41 +0200, Tobias Hammer wrote:
>> 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.r
>> kt: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:7
>> 7: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.hammer at dlr.de
>> _________________________
>>   Racket Developers list:
>>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.