[plt-scheme] "broken compiled code" error

From: Gregory Cooper (greg at cs.brown.edu)
Date: Wed Jul 12 13:24:54 EDT 2006

Would it make sense to use local-expand instead of expand-syntax?
Replacing (expand-syntax #'expr) with (local-expand #'expr 'top-level
'()) seems to get rid of the error, but I'm not sure if it does
exactly what you want.

Greg

On 7/12/06, Kimberley Burchett <kim.burchett at gmail.com> wrote:
> Hi all.  I'm trying to create a language module that behaves like
> FrTime, but performs some static optimization on the FrTime program.
> I've come across an error that I don't understand.  Here's a code
> snippet that triggers the error:
>
>     (module funtime mzscheme
>       (require (only (lib "frtime.ss" "frtime") seconds))
>       (provide seconds)
>       (define-syntax (fun-module-begin stx)
>         (syntax-case stx ()
>           [(_ expr)
>            #`(#%module-begin #,(expand-syntax #'expr))]))
>       (provide (rename fun-module-begin #%module-begin)
>                #%top #%app #%datum))
>     (module broken funtime
>       seconds)    <---- the error highlights this line
>
> The error is:
>
>     require: broken compiled code (phase 0, defn-phase 0): cannot find
>     module |,c:\program files\plt\collects\frtime\lang-ext| in: seconds
>
> I'm using version 350, on windows xp.
>
> The error happens iff the re-exported symbol ("seconds" in this case)
> comes from a require statement that involves a directory name, such as
> (lib "frtime.ss" "frtime") or (lib "html.ss" "html").  In contrast,
> (lib "list.ss") doesn't trigger the problem, and neither do standard
> mzscheme identifiers.
>
> Another way to make the error go away is to remove the call to
> expand-syntax.  Unfortunately that part is essential to my approach.
>
> Anybody have a suggestion?
>
> --
> Kimberley Burchett
> http://www.kimbly.com/
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.