using haskell as a shell language
Juan Carlos Arevalo-Baeza
jcab@roningames.com
Mon, 5 Nov 2001 20:57:35 -0800
On Tue, 6 Nov 2001 04:32:05 +0000 (GMT), D. Tweed wrote:
>[Suggest moving any followup to haskell-cafe to avoid boring=
people]
Sure.
>On Mon, 5 Nov 2001, Juan Carlos Arevalo-Baeza wrote:
>
>>=A0On Tue, 6 Nov 2001 03:42:51 +0000 (GMT), D. Tweed wrote:
>>
>>=A0>The name that
>>=A0>gets passed to the interpreter is `the top-level name of the=
script', so
>>=A0>if /home/tweed/bin/myscript.hs is actually a symlink to
>>=A0>/home/tweed/src/haskell/myscript.hs and I invoke it from=
/home/tweed/odd/
>>=A0>with ../bin/myscript.hs, what gets passed is=
"../bin/myscript.hs" (at
>>=A0>least under bash on linux). So whilst the interpreter could=
in principlex
>>=A0>get to thinking it should look in /home/tweed/bin/ for=
imports by applying
>>=A0>"../bin/myscript.hs" to $cwd, AFAICS there's no way it can=
get hold of the
>>=A0>directory /home/tweed/src/haskell. When I figured this out I=
just decided
>>=A0>that the method that would lead to least banging of my head=
against wall
>>=A0>was just to absolute path any imports of non standard=
distribution code.
>>
>>=A0=A0Well... I still disagree. From my point of view, it could be=
argued the order in which directories are searched for modules,=
but I don't think there's any need to exclude any directories.=
The interpreter should search not just the current directory,=
but also the directory of the file where the source was found.=
At least. I'd even add subdirectories "./modules/" (or=
"./haskell.modules/" or something like that) of both of them,=
just for added value :)
>>
>>=A0=A0IMHO, there's no reason not to search a reasonable place for=
a needed piece of information. It's like Koenig lookups in C++.=
It just makes sense to look there, just in case.
>
>I entirely agree it would be great if this could be done.=
However it seems
>that runhugs at least _doesn't_ do it, and I suspect that may be=
because
>it technically can't.
Oh, it sure can. If a file has hard-links, it just means that=
it can be accessed through two different paths. I'm just saying=
that, looking in the path that was used for accessing the file=
sounds like a very good (and easily implementable) idea to me.
>I never use unix hardlinks myself (only symlinks),
>but IIRC if you've got two or more hardlinks to a file there's=
no way to
>find out from the filesystem what the directories of the other=
links to
>the file are, so if you invoke via a hardlink then it's really=
difficult
>to do automatic imports correctly. (I may be wrong about this.)
Oh, yes. I understand you perfectly. But that's not a good=
reason not to try the one known path. Just in case.
>Incidentally, I do have a setup with
>symlinks as described above; it's not just hypothetical.
>
>>=A0=A0Anyway... This is not my war. Just my opinion. O:-)
>
>Oh, you make very good points, I just suspect that it `can't be=
done'. I'd
>love to be proved wrong :-)
Remember that I'm just advocating in favor of "looking in=
additional places" for the files, nothing more. That's neither=
technically impossible nor unreasonable.
What I'm saying, if you will, is that the fact that the needle=
_might_ be in the haystack doesn't mean that it's not worth=
bothering to look in the needle box. So to speak. :)
Salutaciones,
JCAB
email: jcab@roningames.com
ICQ: 101728263
The Rumblings are back: http://www.JCABs-Rumblings.com