JuliaLang/julia — pull request #8745 by vtjnash (2014-10-21 02:50:47+00:00)
Title: WIP: static compile part 4 (user-interface)

(continuation of #8656 – as I make progress towards incremental module compilation, I'll push the code to this branch for comments and API discussion)

since Julia already has a strong tradition that file != module, I think the primary implementation of this needs to embrace that and use a `*.jlc` file independent of the filesystem. this unifies the behavior `using` and everything in `Base` across restarts. Therefore, a session could look something like the following:

```
julia> using A
note: cache file ~/.julia/v0.4/.lib/A.jlc cannot be used with this Julia image, ignoring file
note: regenerating cache file for module A with code from /home/user/.julia/v0.4/A/src/A.jl

julia> using B
note: cache file ~/.julia/v0.4/.lib/B.jlc cannot be used with this Julia image, ignoring file
note: could not find `B.jl` in PATH to satisfy requested module dependency
ERROR: B not found
in require at ./loading.jl:49
in require at /Volumes/Lion/Users/jameson/Documents/julia/usr/lib/julia/sys.dylib

julia> using C
note: regenerating cache file for module C with code from /home/user/.julia/v0.4/C/src/C.jl

julia> using D
note: could not find `D.jl` in PATH to satisfy requested module dependency
ERROR: B not found
in require at ./loading.jl:49
in require at /Volumes/Lion/Users/jameson/Documents/julia/usr/lib/julia/sys.dylib

julia> using D # this one is already in the session

julia> using E # this one is already in the cache (`~/.julia/v0.4/E.jlc`)

julia>
```

And invoking the cache file engine would look something like the following:
```julia
$ ./julia -f --build $HOME/.julia/v$(cut -d . -f 1,2 VERSION)\
-J sys.ji -L LOAD_PATH.jl
~/.julia/v0.4/FixedPointNumbers/src/FixedPointNumbers.jl
```
or via stdin:
```julia
$ ./julia -f --build $HOME/.julia/v$(cut -d . -f 1,2 VERSION)\
-J sys.ji -
empty!(LOAD_PATH)
push!(LOAD_PATH, "path1")
push!(LOAD_PATH, "path2")
include("~/.julia/v0.4/FixedPointNumbers/src/FixedPointNumbers.jl")
^D
```

any logic to handle dependencies differently would be handled externally, e.g. https://github.com/malmaud/Autoreload.jl