[racket] Understanding raco make and its correctness guarantees

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Thu Mar 21 04:51:22 EDT 2013

The difference lies in the method how racket and raco make check for  
changes.
- racket only looks at each individual file's timestamp source and .zo  
timestamp and uses whichever is never.
- raco make always checks if the file has changed or any of its  
dependencies has changed to decide if it has to recompile the file.

Whats happens in version 1 is that the macro is already expanded in a.zo  
and a.zo is still never than a.rkt. Therefore racket loads a.zo (but  
b.rkt) and prints 'version1.
In version 2 raco make (or more correctly compiler/cm) checks a.rkt, finds  
the dependency to b.rkt, notices the change in b.rkt (by calculating a  
checksum over the whole dependency tree if i remember correct) and  
therefore recompiles a.rkt AND b.rkt.

Version 3 should as far as i understand never differ, assumed raco make  
works.

Tobias


On Thu, 21 Mar 2013 06:23:24 +0100, Eric Dobson <eric.n.dobson at gmail.com>  
wrote:

> I'm trying to understand what are the guarantees that raco make is
> meant to provide. I'm going to limit this to simple programs, no fancy
> dynamic requires, or trying to trick the compiler.
>
> In the following scenario:
> 1. Edit files
> 2. run 'raco make <files>'
> 3. Change files
> I expect all of these to have the same effect during the running of
> phase 0 when running racket.
> 4. racket <main-file>
> or
> 4. raco make <files>
> 5. racket <main-file>
> or
> 4. rm -rf compiled/
> 5. raco make <files>
> 6. racket <main-file>
>
> I can make version 1 and 2 differ with the following program:
> a.rkt
> #lang racket
> (require "b.rkt")
> (macro)
>
> #lang racket
> (provide maco)
> (define-syntax (macro stx)
>   #''version1)
>
> Where the edit is changing version1 to version2. I can also replicate
> this with a function and not a macro.
>
> I thought I could make version 2 and version 3 differ, but cannot seem
> to replicate it now, but it would be helpful to know if I see
> something that is fixed by clearing the compiled directories.
>
> My understanding was that racket used the same logic as raco make on
> whether or not to use the compiled versions versus recompiling, and
> this seems to refute that. Can someone give some insight on what I
> should be expecting?
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


-- 
---------------------------------------------------------
Tobias Hammer
DLR / Robotics and Mechatronics Center (RMC)
Muenchner Str. 20, D-82234 Wessling
Tel.: 08153/28-1487
Mail: tobias.hammer at dlr.de

Posted on the users mailing list.