Yes, I think this is how I understand it also. Maybe it’s idiosyncratic but if I’m working on the command line I never have any doubts what is the cwd. For example, if I cd
to /usr
and do an ls .
I expect to see the contents of /usr
. If I’m in doubt where I am there’s pwd
. So in that case the cwd is clearly the path we could say the current terminal process is running from (even if that’s not what is really happening internally; at the user level, that’s what it looks like).
The problems begin if a process is started from a file called from another process. In that case there is no clear cwd: is it the file’s path, or the path of the process calling the file? I think that’s what you’re pointing out. But I don’t see how there can be an absolute, in the sense of objective, answer to that. @jan says above that most systems used to go one way, now they go the other way, so I guess it’s a kind of trend, like it’s a trend nowadays to “prefer composition over inheritance” in OOP circles (or has the trend changed yet?).
Btw, my original query, in the other post I linked, was about the different behaviour between ls
and use_module/1
in SWI. It seems getting it right and consistent is going to be a big headache for @jan.