I think you missed the fact that include
operates relative to @__DIR__
, which has nothing to do with the “current directory”, which is essentially a global state. Cf
$ pwd
/home/tamas
$ cat /tmp/test.jl
@info "working directory" pwd()
@info "directory of file" @__DIR__
$ julia /tmp/test.jl
┌ Info: working directory
└ pwd() = "/home/tamas"
┌ Info: directory of file
└ #= /tmp/test.jl:2 =# @__DIR__ = "/tmp"
As explained by @pixel27, conflating the two would have obvious disadvantages — global state should be avoided unless absolutely necessary.