[racket] current-load/use-compiled and old .zo files

From: Gustavo Massaccesi (gustavo at oma.org.ar)
Date: Tue Jan 22 12:25:58 EST 2013

Thanks. Yesterday I tested the two ideas a few times.

I tried with _raco make_, but it only can compile one file, not every
file in the folder.

I found _raco setup -l <col>_ more useful. I created a collection that
include all my files and then compiled it. It's also useful because it
follows the preferences in the info.ss or info.rkt files (for example,
to exclude some subfolders).

Gustavo



On Sun, Jan 20, 2013 at 12:13 PM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> I'm not sure of the ramifications of a change like that to
> current-load/use-compiled, but here are two thoughts that don't require that
> change:
>
> - use 'raco make' to recompile the files (instead of the racket script you
> have there)
>
> - set up your directories as collections using 'raco link' and then run
> 'raco setup' and that will rebuild everything (.zos and documentation
> mostly, but this is the path that the distribution itself uses, so you can
> use it for anything that you see happening there).
>
> Robby
>
>
> On Sun, Jan 20, 2013 at 8:03 AM, Gustavo Massaccesi <gustavo at oma.org.ar>
> wrote:
>>
>> Hi!
>>
>> Each time I install a new version of Racket I have a problem with the
>> old .zo files compiled with the old version.
>>
>> I have the following program in my personal root racket folder that I
>> use to compile all the files in all the subfolders:
>>
>> ;---
>>   #lang racket/base
>>   (require compiler/compiler)
>>   (require setup/getinfo)
>>
>>   (compile-directory-zos (current-directory)
>>                          (get-info/full (current-directory)))
>> ;---
>>
>>
>> After upgrading, I get the error:
>>
>>   [file] read (compiled): wrong version for compiled code
>>   compiled version: 5.3
>>   expected version: 5.3.1
>>
>> So, I have to manually delete all the old .zo files that are
>> distributed in many subfolders.
>>
>>
>> Now I'm using the following program that automatically deletes the old
>> .zo files. (Warning: I'm not sure that in some corner case it can't
>> delete the wrong file.)
>>
>> ;---
>>   #lang racket/base
>>   (require compiler/compiler)
>>   (require setup/getinfo)
>>
>>   (let ([old-c-l/u-c (current-load/use-compiled)])
>>     (parameterize ([current-load/use-compiled {lambda (path name)
>>                                                 (with-handlers*
>> ([exn:fail:read? {lambda (exn)
>>
>>             (write (srcloc-source (car (exn:fail:read-srclocs exn))))
>>
>>             (delete-file (srcloc-source (car (exn:fail:read-srclocs
>> exn))))
>>
>>           (old-c-l/u-c path name)}])
>>
>> (old-c-l/u-c path name))}])
>>       (compile-directory-zos (current-directory)
>>                              (get-info/full (current-directory)))))
>> ;---
>>
>> But it still has problems with the .ss files that have a compiled version.
>>
>>
>> Is there a more elegant/correct way to do this?
>>
>> I saw the implementation of default-load/use-compiled, but it's very
>> long. Is it possible to change the implementation of it, so it use the
>> .zo files only when they have the correct version?
>>
>>
>> Gustavo
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>
>

Posted on the users mailing list.