<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -6,9 +6,24 @@
             &quot;app.arc&quot;
             &quot;prompt.arc&quot;))
 
-; TODO: allow specification of dependencies for load-ordering in some way
+; We define 'require here, rather than in a file in load/ so that things in
+; load/ can use it for load-ordering.
+(unless (and (bound 'required-files*) required-files*)
+  (= required-files* (table)))
+
+(def require (file)
+  &quot; Loads `file' if it has not yet been `require'd.  Can be fooled by changing
+    the name ((require \&quot;foo.arc\&quot;) as opposed to (require \&quot;./foo.arc\&quot;)), but
+    this should not be a problem.
+    See also [[load]]. &quot;
+  (or (required-files* file)
+    (do (set required-files*.file)
+        (load file))))
+
 (def autoload ((o dirname &quot;load&quot;))
+  &quot; 'require each file in `dirname' ending in \&quot;.arc\&quot;.
+    See also [[require]] &quot;
   (each f (dir-exists&amp;dir dirname)
-    (if (endmatch &quot;.arc&quot; f) (load (+ dirname &quot;/&quot; f)))))
+    (if (endmatch &quot;.arc&quot; f) (require (+ dirname &quot;/&quot; f)))))
 
 (autoload)</diff>
      <filename>libs.arc</filename>
    </modified>
    <modified>
      <diff>@@ -5,10 +5,6 @@ Code should go here only if it is either:
 
 1. An important language extension (eg 'make-br-fn), especially one which a
    library writer would find obnoxious or undesirable to have to 'load manually.
-   For example, having to load a file to use 'require (&quot;load this file unless it
-   has already been loaded&quot;) would more or less defeat the purpose.
-   
-   (on that note, TODO: implement 'require.)
 
 2. Features important for, and preferably specific to, the REPL. For example, an
    interactive help subsystem.</diff>
      <filename>load/README</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>load/require.arc</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>f4c83bb5aa8a674796027419c0d2197a38d1a1d6</id>
    </parent>
  </parents>
  <author>
    <name>Michael Arntzenius</name>
    <email>daekharel@gmail.com</email>
  </author>
  <url>http://github.com/nex3/arc/commit/8e568598832175a5ad18398bd537bf10a3d8b138</url>
  <id>8e568598832175a5ad18398bd537bf10a3d8b138</id>
  <committed-date>2009-08-24T06:39:16-07:00</committed-date>
  <authored-date>2009-08-24T06:39:16-07:00</authored-date>
  <message>move 'require into libs.arc so that load/*.arc can use it for load-ordering</message>
  <tree>e859daaa0c9b5b1e4d91c8c7d8e9f834c8e0d604</tree>
  <committer>
    <name>Michael Arntzenius</name>
    <email>daekharel@gmail.com</email>
  </committer>
</commit>
