Re: How does Require deal with multiple files of the same name in different directories




Coos Haak wrote:
Op 10 Aug 2006 01:34:56 -0700 schreef George Hubert:

Marcel Hendrix wrote:
"George Hubert" <georgeahubert@xxxxxxxxxxx> writes Re: How does Require deal with multiple files of the same name in
[..]
I tend to agree if no file in the search path can possibly match (so
include would fail anyway) a check could be made for any file and if
one exists assume it's correct (pssibly issuing a warning). The problem
[ ... etcetera. ]

Please, isn't REQUIRE a tool for development? If REQUIRE reloads a file
that actually is loaded already, the recompilation takes a few milliseconds
longer than it should. If it fails to load a new version of a file already
loaded, why not explicitly forget the old code and recompile from scratch?


Re-loading the file may have unexpected consequences e.g.

The function of REQUIRE is one-time loading. So the following doesn't
occur:

REQUIRE tests if the file is loaded. There are ambiguous conditions
such as;
1) A fully qualified path is used where a file of the same name but
with a different
path is loaded.
2) A relative path is specified and more than one path in the paths
list results in
a valid file where one of those files other than the first is loaded
(for the first matching
path the system should always say the file is loaded).
3) A relative path is specified that matches a file that is loaded, but
the path for
the loaded file isn't in the search path (probably as a result of
changing the search
path or the current directory).
It's those ambiguous conditions I'm trying to find the most reasonable
way to deal
with.

1) The file begins with an ANEW MyMarker so all code between the first
load
and the re-load is forgotten.
2) A list of re-definition warnings.
3) Some files re-initialise certain things when loaded (and in those
cases add
code to do this at start-up to the initialisation chain) which can
cause problems.

You're describing the function of INCLUDE

Where the file is deamed not to be loaded then REQUIRE performs the
action of
INCLUDE; the problem is handling those cases for relative files where
more than
one file could be deamed to be the one REQUIREd.

It may reload the same file and execute MARKERS and ANEW with probably
fatal consequences. REQUIRE doesn't.

Not necessarily; if the programmers intends to reload the file
(possibly after
editing) then that's precisely the action they want.

--
Coos

CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html

George Hubert

.



Relevant Pages

  • Re: How does Require deal with multiple files of the same name in different directories
    ... include would fail anyway) a check could be made for any file and if ... one exists assume it's correct (pssibly issuing a warning). ... Re-loading the file may have unexpected consequences e.g. ... search path that matches a relative path is loaded, ...
    (comp.lang.forth)
  • Re: gcc-4 ?
    ... FAIL: gcc.dg/builtins-20.c (test for excess errors) ... WARNING: Couldn't find the global config file. ... FAIL: externs-12 execution ...
    (freebsd-questions)
  • Re: 3^n and primes
    ... Now, as you showed, when p=60, one of the "triples" for 3 is divisible ... Of course, it could fail at 351, etc. ... Someone was nice enough to run the following Mathematica code that I ... turned into this file -- Warning! ...
    (sci.math)
  • Re: How does Require deal with multiple files of the same name in different directories
    ... include would fail anyway) a check could be made for any file and if ... one exists assume it's correct (pssibly issuing a warning). ... Re-loading the file may have unexpected consequences e.g. ...
    (comp.lang.forth)
  • Re: Million Illegals March today.
    ... Are your essays as truthful and thoughtful as the unthinking lie "Under the DMCA legislation I can prosecute you for electronic trespassing if you fail to obey this warning" you just posted? ...
    (alt.politics.bush)