Re: How does Require deal with multiple files of the same name in
- From: "George Hubert" <georgeahubert@xxxxxxxxxxx>
- Date: 10 Aug 2006 00:57:31 -0700
Jos van de Ven wrote:
"George Hubert" wrote:
Jos van de Ven wrote:
"George Hubert" wrote:
I'm coming round to the following. The is file loaded test should return
true;
1) If an absolute path is specified and that file is loaded.
2) If a relative path is specified, there is at least one file in the
search path that matches and any of the matching files are loaded
(possibly issuing a warning if more than one file is in the path).
3) If a relative path is specified, there are no files in the search
path that match but there is a file loaded that would match (possibly
issuing a warning that the file isn't in the current path).
So far agreed.
4) If a relative path is specified, there is at least one file in the
search path that matches but none are loaded though there is a file
that matches in the search order and a system variable is set to a
never reload if any matching file is present mode.
Perhaps the same behaviour should take place when an absolute path is specified.
When a system variable is set to a never reload, require does not load any
file at all.
Surely if an absolute path is specified the program wants that specific
file loaded, even if another file of the same name is loaded? I can't
think of any program where that applies (every program I know uses
NEEDS or REQUIRE with a relative path anyway; they assume the files are
going to be either the current dircetory (or a sub-directory) or the
Forth system directories), so it wouldn't really bother me either way.
The main problem is that older versions of Win32Forth (such as V4.2)
only stored the file name so wouldn't re-load a file if any file of
that name were loaded.
Is there a case in which a file will be re-loaded using the 4 conditions above?
No! If the sytem variable is set to not reload a warning could be
issued, perhaps stating which file (i.e. the full path) is already
loaded. If the variable is set to re-load then the first matching file
in the search is loaded; in that case no specific information is
presented although the file could do .( Loading Foo.... ) to inform the
user (a good idea in general anyway).
Jos
George Hubert
.
- References:
- How does Require deal with multiple files of the same name in different directories
- From: George Hubert
- Re: How does Require deal with multiple files of the same name in different directories
- From: Marcel Hendrix
- Re: How does Require deal with multiple files of the same name in different
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in different
- From: Coos Haak
- Re: How does Require deal with multiple files of the same name in different
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in different
- From: Jerry Avins
- Re: How does Require deal with multiple files of the same name in
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in
- From: Coos Haak
- Re: How does Require deal with multiple files of the same name in
- From: George Hubert
- Re: How does Require deal with multiple files of the same name in
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in
- From: George Hubert
- Re: How does Require deal with multiple files of the same name in
- From: Jos van de Ven
- Re: How does Require deal with multiple files of the same name in
- From: George Hubert
- Re: How does Require deal with multiple files of the same name in
- From: Jos van de Ven
- How does Require deal with multiple files of the same name in different directories
- Prev by Date: Re: Project proposal -- Forth project organiser
- Next by Date: Re: How does Require deal with multiple files of the same name in different directories
- Previous by thread: Re: How does Require deal with multiple files of the same name in
- Next by thread: Re: How does Require deal with multiple files of the same name in different directories
- Index(es):
Relevant Pages
|