pwd()
doesn't actually print the working directory, it returns it:
julia> a = pwd();
julia> a
"U:\\"
This isn't a doc issue per se, since the docs are correct:
help?> pwd
search: pwd powermod print_with_color
pwd() -> AbstractString
Get the current working directory.
It's just unfortunate that the function is named "print working directory", instead of cwd
's "current working directory".
pwd
cwd
current_dir
getwd
This function was previously named cwd
and was renamed as part of a large file API rename. The name pwd
was chosen because there's not a broad consensus on what to call this function across programming languages (cwd
, pwd
, getwd
, getcwd
). Before that the same function was called getcwd
. Empirically, so far the name pwd
seems to have generated the least confusion and complaints. It matches Ruby and Matlab which form a maximal agreeing set of languages for this function name in the API comparison spreadsheet linked above in issue #1782.
I would add all UNIX shells to the pwd
set in the above. Technically the shell prints the working directory, but that's because printing is how the shell returns things. In general, we have tried to follow the same naming as UNIX shells for file and path operations since that's the interface that by far the largest number of people are familiar with.
Ok, I am satisfied that it was well considered.
I'm just going to have to say to myself Present Working Directory
10 times and get over it
Consider that the POSIX standard is itself inconsistent in a similar way: it defines
I like current_dir from rust
Looks like we are happy with pwd
Most helpful comment
Looks like we are happy with
pwd