[MLton-commit] r6175

Vesa Karvonen vesak at mlton.org
Mon Nov 19 05:33:38 PST 2007


Simplified the UseLib interface.  Fixed UseLib to work properly with Alice
ML's use -function semantics.  Eliminated UseLib's trace facility for now.

----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/async/unstable/example/poll-loop/lib.use
U   mltonlib/trunk/com/ssh/async/unstable/example/smlbot/smlbot.use
U   mltonlib/trunk/com/ssh/async/unstable/lib.use
U   mltonlib/trunk/com/ssh/async/unstable/test.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/basis.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/extensions.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/workarounds.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/extensions.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/workarounds.use
U   mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
U   mltonlib/trunk/com/ssh/generic/unstable/detail/ml/polyml/extensions.use
U   mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/extensions.use
U   mltonlib/trunk/com/ssh/generic/unstable/lib-with-default.use
U   mltonlib/trunk/com/ssh/generic/unstable/lib.use
U   mltonlib/trunk/com/ssh/generic/unstable/test.use
U   mltonlib/trunk/com/ssh/prettier/unstable/lib.use
U   mltonlib/trunk/com/ssh/random/unstable/detail/ml/polyml/random-dev.use
U   mltonlib/trunk/com/ssh/random/unstable/detail/ml/smlnj/random-dev.use
U   mltonlib/trunk/com/ssh/random/unstable/lib.use
U   mltonlib/trunk/com/ssh/unit-test/unstable/example.use
U   mltonlib/trunk/com/ssh/unit-test/unstable/lib-with-default.use
U   mltonlib/trunk/com/ssh/unit-test/unstable/lib.use
U   mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use
U   mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/ml/alice/workarounds.sml
U   mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/use-lib.sml
U   mltonlib/trunk/org/mlton/vesak/use-lib/unstable/public/use-lib.sig

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/async/unstable/example/poll-loop/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/example/poll-loop/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/async/unstable/example/poll-loop/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,5 +4,5 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../../..//extended-basis/unstable/basis.use"],
-     self = ["poll-loop.sml"]} ;
+lib ["../../../../extended-basis/unstable/basis.use",
+     "poll-loop.sml"] ;

Modified: mltonlib/trunk/com/ssh/async/unstable/example/smlbot/smlbot.use
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/example/smlbot/smlbot.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/async/unstable/example/smlbot/smlbot.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,10 +4,10 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../../../extended-basis/unstable/basis.use",
-             "../../lib.use",
-             "../poll-loop/lib.use"],
-     self = ["text-io.sml",
-             "text-prim-io.sml",
-             "smlbot.sml",
-             "main.sml"]} ;
+lib ["../../../../extended-basis/unstable/basis.use",
+     "../../lib.use",
+     "../poll-loop/lib.use",
+     "text-io.sml",
+     "text-prim-io.sml",
+     "smlbot.sml",
+     "main.sml"] ;

Modified: mltonlib/trunk/com/ssh/async/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/async/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,8 +4,8 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../../../org/mlton/vesak/ds/unstable/lib.use",
-             "../../extended-basis/unstable/basis.use"],
-     self = ["public/async.sig",
-             "detail/async.sml",
-             "public/export.sml"]} ;
+lib ["../../../../org/mlton/vesak/ds/unstable/lib.use",
+     "../../extended-basis/unstable/basis.use",
+     "public/async.sig",
+     "detail/async.sml",
+     "public/export.sml"] ;

Modified: mltonlib/trunk/com/ssh/async/unstable/test.use
===================================================================
--- mltonlib/trunk/com/ssh/async/unstable/test.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/async/unstable/test.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,8 +4,8 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../generic/unstable/lib-with-default.use",
-             "../../unit-test/unstable/lib-with-default.use",
-             "../../extended-basis/unstable/basis.use",
-             "lib.use"],
-     self = ["test/async.sml"]} ;
+lib ["../../generic/unstable/lib-with-default.use",
+     "../../unit-test/unstable/lib-with-default.use",
+     "../../extended-basis/unstable/basis.use",
+     "lib.use",
+     "test/async.sml"] ;

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/basis.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/basis.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/basis.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -8,5 +8,4 @@
  * directory of this library (the directory of this file).
  *)
 
-lib {reqs = ["extensions.use"],
-     self = []} ;
+lib ["extensions.use"] ;

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/extensions.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/extensions.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,7 +4,4 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-UseLib.Trace.disabled
-(fn () =>
-    app use
-        ["detail/ml/common/ext.sml"]) ;
+lib ["../common/ext.sml"] ;

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/workarounds.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/workarounds.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/polyml/workarounds.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -1,7 +1,7 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+(* Copyright (C) 2006-2007 SSH Communications Security, Helsinki, Finland
  *
  * This code is released under the MLton license, a BSD-style license.
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-(* None *)
+lib [] ;

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/extensions.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/extensions.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,7 +4,4 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-UseLib.Trace.disabled
-(fn () =>
-    app use
-        ["detail/ml/smlnj/ext.sml"]) ;
+lib ["ext.sml"] ;

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/workarounds.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/workarounds.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/smlnj/workarounds.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,15 +4,12 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-UseLib.Trace.disabled
-(fn () =>
-    app (fn file => use ("detail/ml/smlnj/workarounds/"^file))
-        ["mk-real-sane.fun",
-         "char.sig",
-         "real.sig",
-         "reals.sml",
-         "string.sig",
-         "text.sig",
-         "text.sml"]) ;
+lib ["workarounds/mk-real-sane.fun",
+     "workarounds/char.sig",
+     "workarounds/real.sig",
+     "workarounds/reals.sml",
+     "workarounds/string.sig",
+     "workarounds/text.sig",
+     "workarounds/text.sml"] ;
 
 (* XXX Is there a way to "forget" top-level bindings in SML/NJ? *)

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,165 +4,164 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = [],
-     self = ["detail/ml/${SML_COMPILER}/workarounds.use",
-             "detail/ml/common/basis.sml",
-             "detail/ml/${SML_COMPILER}/basis.sml",
-             "detail/bootstrap.sml",
-             "detail/ml/${SML_COMPILER}/extensions.use",
-             "public/typing/phantom.sig",
-             "detail/typing/phantom.sml",
-             "public/concept/bitwise.sig",
-             "public/concept/bounded.sig",
-             "public/concept/cased.sig",
-             "public/concept/cstringable.sig",
-             "public/concept/equality.sig",
-             "public/concept/flags.sig",
-             "public/concept/func.sig",
-             "public/concept/intable.sig",
-             "public/concept/largeable.sig",
-             "public/concept/monad.sig",
-             "public/concept/ordered.sig",
-             "public/concept/scannable.sig",
-             "public/concept/shiftable.sig",
-             "public/concept/signed.sig",
-             "public/concept/stringable.sig",
-             "public/concept/t.sig",
-             "public/concept/wordable.sig",
-             "public/concept/formattable.sig",
-             "detail/concept/mk-bounded.fun",
-             "detail/concept/mk-equality.fun",
-             "detail/concept/mk-scannable.fun",
-             "detail/concept/mk-stringable.fun",
-             "detail/concept/mk-cstringable.fun",
-             "public/data/void.sig",
-             "public/fn/fn.sig",
-             "detail/fn/fn.sml",
-             "public/basic.sig",
-             "detail/basic.sml",
-             "public/data/unit.sig",
-             "public/data/sq.sig",
-             "detail/data/sq.sml",
-             "public/fn/bin-fn.sig",
-             "detail/fn/bin-fn.sml",
-             "public/fn/un-op.sig",
-             "detail/fn/un-op.sml",
-             "public/fn/thunk.sig",
-             "detail/fn/thunk.sml",
-             "public/data/univ.sig",
-             "detail/data/univ-ref.sml",
-             "detail/data/univ-exn.sml",
-             "detail/ml/${SML_COMPILER}/univ.sml",
-             "public/fn/bin-op.sig",
-             "detail/fn/bin-op.sml",
-             "public/fn/effect.sig",
-             "detail/fn/effect.sml",
-             "public/generic/fix.sig",
-             "detail/generic/fix.sml",
-             "public/fn/un-pr.sig",
-             "detail/fn/un-pr.sml",
-             "public/data/order.sig",
-             "detail/data/order.sml",
-             "public/fn/bin-pr.sig",
-             "detail/fn/bin-pr.sml",
-             "public/fn/cmp.sig",
-             "detail/fn/cmp.sml",
-             "detail/concept/mk-ordered.fun",
-             "public/data/ref.sig",
-             "detail/data/ref.sml",
-             "public/data/bool.sig",
-             "detail/data/bool.sml",
-             "public/data/product-type.sig",
-             "public/data/pair.sig",
-             "detail/data/pair.sml",
-             "public/data/product.sig",
-             "detail/data/product.sml",
-             "public/fold/fold.sig",
-             "detail/fold/fold.sml",
-             "detail/concept/mk-monad.fun",
-             "public/control/with.sig",
-             "detail/control/with.sml",
-             "public/data/sum.sig",
-             "detail/data/sum.sml",
-             "public/control/exn.sig",
-             "detail/control/exn.sml",
-             "public/generic/emb.sig",
-             "detail/generic/emb.sml",
-             "public/generic/iso.sig",
-             "detail/generic/iso.sml",
-             "public/generic/tie.sig",
-             "detail/generic/tie.sml",
-             "public/sequence/array.sig",
-             "public/sequence/array-slice.sig",
-             "public/sequence/vector.sig",
-             "public/sequence/vector-slice.sig",
-             "detail/sequence/mk-seq-common-ext.fun",
-             "detail/sequence/array.sml",
-             "detail/sequence/array-slice.sml",
-             "detail/sequence/vector.sml",
-             "detail/sequence/vector-slice.sml",
-             "public/data/option.sig",
-             "detail/data/option.sml",
-             "public/numeric/integer.sig",
-             "public/numeric/int-inf.sig",
-             "public/numeric/real.sig",
-             "public/numeric/word.sig",
-             "detail/numeric/mk-integer-ext.fun",
-             "detail/numeric/mk-int-inf-ext.fun",
-             "detail/numeric/mk-real-ext.fun",
-             "detail/numeric/mk-word-ext.fun",
-             "detail/ml/common/scalars.sml",
-             "detail/ml/${SML_COMPILER}/ints.sml",
-             "detail/ml/${SML_COMPILER}/reals.sml",
-             "detail/ml/${SML_COMPILER}/words.sml",
-             "public/sequence/list.sig",
-             "detail/sequence/list.sml",
-             "public/sequence/buffer.sig",
-             "detail/sequence/mk-buffer-common.fun",
-             "detail/sequence/buffer.sml",
-             "public/sequence/resizable-array.sig",
-             "detail/sequence/resizable-array.sml",
-             "public/io/reader.sig",
-             "detail/io/reader.sml",
-             "public/io/writer.sig",
-             "detail/io/writer.sml",
-             "public/io/ios-monad.sig",
-             "detail/io/ios-monad.sml",
-             "public/control/exit.sig",
-             "detail/control/exit.sml",
-             "public/sequence/mono-vector.sig",
-             "public/sequence/mono-vector-slice.sig",
-             "public/sequence/mono-array.sig",
-             "public/sequence/mono-array-slice.sig",
-             "public/text/char.sig",
-             "public/text/string.sig",
-             "public/text/substring.sig",
-             "public/text/text.sig",
-             "detail/sequence/mk-mono-seq-common-ext.fun",
-             "detail/sequence/mk-mono-vector-ext.fun",
-             "detail/sequence/mk-mono-vector-slice-ext.fun",
-             "detail/sequence/mk-mono-array-ext.fun",
-             "detail/sequence/mk-mono-array-slice-ext.fun",
-             "detail/text/mk-text-ext.fun",
-             "detail/ml/common/mono-seqs.sml",
-             "detail/ml/${SML_COMPILER}/mono-vectors.sml",
-             "detail/ml/${SML_COMPILER}/mono-vector-slices.sml",
-             "detail/ml/${SML_COMPILER}/mono-arrays.sml",
-             "detail/ml/${SML_COMPILER}/mono-array-slices.sml",
-             "detail/ml/${SML_COMPILER}/texts.sml",
-             "public/sequence/stream.sig",
-             "detail/sequence/stream.sml",
-             "public/lazy/lazy.sig",
-             "detail/lazy/lazy.sml",
-             "public/fn/shift-op.sig",
-             "public/io/text-io.sig",
-             "detail/io/text-io.sml",
-             "public/os/os-file-sys.sig",
-             "public/os/os.sig",
-             "detail/os/os.sml",
-             "detail/concept/mk-word-flags.fun",
-             "public/export/${SML_COMPILER}.sml",
-             "public/export/common.sml",
-             "public/export/top-level.sml",
-             "public/export/infixes.sml",
-             "public/export/open-top-level.sml"]} ;
+lib ["detail/ml/${SML_COMPILER}/workarounds.use",
+     "detail/ml/common/basis.sml",
+     "detail/ml/${SML_COMPILER}/basis.sml",
+     "detail/bootstrap.sml",
+     "detail/ml/${SML_COMPILER}/extensions.use",
+     "public/typing/phantom.sig",
+     "detail/typing/phantom.sml",
+     "public/concept/bitwise.sig",
+     "public/concept/bounded.sig",
+     "public/concept/cased.sig",
+     "public/concept/cstringable.sig",
+     "public/concept/equality.sig",
+     "public/concept/flags.sig",
+     "public/concept/func.sig",
+     "public/concept/intable.sig",
+     "public/concept/largeable.sig",
+     "public/concept/monad.sig",
+     "public/concept/ordered.sig",
+     "public/concept/scannable.sig",
+     "public/concept/shiftable.sig",
+     "public/concept/signed.sig",
+     "public/concept/stringable.sig",
+     "public/concept/t.sig",
+     "public/concept/wordable.sig",
+     "public/concept/formattable.sig",
+     "detail/concept/mk-bounded.fun",
+     "detail/concept/mk-equality.fun",
+     "detail/concept/mk-scannable.fun",
+     "detail/concept/mk-stringable.fun",
+     "detail/concept/mk-cstringable.fun",
+     "public/data/void.sig",
+     "public/fn/fn.sig",
+     "detail/fn/fn.sml",
+     "public/basic.sig",
+     "detail/basic.sml",
+     "public/data/unit.sig",
+     "public/data/sq.sig",
+     "detail/data/sq.sml",
+     "public/fn/bin-fn.sig",
+     "detail/fn/bin-fn.sml",
+     "public/fn/un-op.sig",
+     "detail/fn/un-op.sml",
+     "public/fn/thunk.sig",
+     "detail/fn/thunk.sml",
+     "public/data/univ.sig",
+     "detail/data/univ-ref.sml",
+     "detail/data/univ-exn.sml",
+     "detail/ml/${SML_COMPILER}/univ.sml",
+     "public/fn/bin-op.sig",
+     "detail/fn/bin-op.sml",
+     "public/fn/effect.sig",
+     "detail/fn/effect.sml",
+     "public/generic/fix.sig",
+     "detail/generic/fix.sml",
+     "public/fn/un-pr.sig",
+     "detail/fn/un-pr.sml",
+     "public/data/order.sig",
+     "detail/data/order.sml",
+     "public/fn/bin-pr.sig",
+     "detail/fn/bin-pr.sml",
+     "public/fn/cmp.sig",
+     "detail/fn/cmp.sml",
+     "detail/concept/mk-ordered.fun",
+     "public/data/ref.sig",
+     "detail/data/ref.sml",
+     "public/data/bool.sig",
+     "detail/data/bool.sml",
+     "public/data/product-type.sig",
+     "public/data/pair.sig",
+     "detail/data/pair.sml",
+     "public/data/product.sig",
+     "detail/data/product.sml",
+     "public/fold/fold.sig",
+     "detail/fold/fold.sml",
+     "detail/concept/mk-monad.fun",
+     "public/control/with.sig",
+     "detail/control/with.sml",
+     "public/data/sum.sig",
+     "detail/data/sum.sml",
+     "public/control/exn.sig",
+     "detail/control/exn.sml",
+     "public/generic/emb.sig",
+     "detail/generic/emb.sml",
+     "public/generic/iso.sig",
+     "detail/generic/iso.sml",
+     "public/generic/tie.sig",
+     "detail/generic/tie.sml",
+     "public/sequence/array.sig",
+     "public/sequence/array-slice.sig",
+     "public/sequence/vector.sig",
+     "public/sequence/vector-slice.sig",
+     "detail/sequence/mk-seq-common-ext.fun",
+     "detail/sequence/array.sml",
+     "detail/sequence/array-slice.sml",
+     "detail/sequence/vector.sml",
+     "detail/sequence/vector-slice.sml",
+     "public/data/option.sig",
+     "detail/data/option.sml",
+     "public/numeric/integer.sig",
+     "public/numeric/int-inf.sig",
+     "public/numeric/real.sig",
+     "public/numeric/word.sig",
+     "detail/numeric/mk-integer-ext.fun",
+     "detail/numeric/mk-int-inf-ext.fun",
+     "detail/numeric/mk-real-ext.fun",
+     "detail/numeric/mk-word-ext.fun",
+     "detail/ml/common/scalars.sml",
+     "detail/ml/${SML_COMPILER}/ints.sml",
+     "detail/ml/${SML_COMPILER}/reals.sml",
+     "detail/ml/${SML_COMPILER}/words.sml",
+     "public/sequence/list.sig",
+     "detail/sequence/list.sml",
+     "public/sequence/buffer.sig",
+     "detail/sequence/mk-buffer-common.fun",
+     "detail/sequence/buffer.sml",
+     "public/sequence/resizable-array.sig",
+     "detail/sequence/resizable-array.sml",
+     "public/io/reader.sig",
+     "detail/io/reader.sml",
+     "public/io/writer.sig",
+     "detail/io/writer.sml",
+     "public/io/ios-monad.sig",
+     "detail/io/ios-monad.sml",
+     "public/control/exit.sig",
+     "detail/control/exit.sml",
+     "public/sequence/mono-vector.sig",
+     "public/sequence/mono-vector-slice.sig",
+     "public/sequence/mono-array.sig",
+     "public/sequence/mono-array-slice.sig",
+     "public/text/char.sig",
+     "public/text/string.sig",
+     "public/text/substring.sig",
+     "public/text/text.sig",
+     "detail/sequence/mk-mono-seq-common-ext.fun",
+     "detail/sequence/mk-mono-vector-ext.fun",
+     "detail/sequence/mk-mono-vector-slice-ext.fun",
+     "detail/sequence/mk-mono-array-ext.fun",
+     "detail/sequence/mk-mono-array-slice-ext.fun",
+     "detail/text/mk-text-ext.fun",
+     "detail/ml/common/mono-seqs.sml",
+     "detail/ml/${SML_COMPILER}/mono-vectors.sml",
+     "detail/ml/${SML_COMPILER}/mono-vector-slices.sml",
+     "detail/ml/${SML_COMPILER}/mono-arrays.sml",
+     "detail/ml/${SML_COMPILER}/mono-array-slices.sml",
+     "detail/ml/${SML_COMPILER}/texts.sml",
+     "public/sequence/stream.sig",
+     "detail/sequence/stream.sml",
+     "public/lazy/lazy.sig",
+     "detail/lazy/lazy.sml",
+     "public/fn/shift-op.sig",
+     "public/io/text-io.sig",
+     "detail/io/text-io.sml",
+     "public/os/os-file-sys.sig",
+     "public/os/os.sig",
+     "detail/os/os.sml",
+     "detail/concept/mk-word-flags.fun",
+     "public/export/${SML_COMPILER}.sml",
+     "public/export/common.sml",
+     "public/export/top-level.sml",
+     "public/export/infixes.sml",
+     "public/export/open-top-level.sml"] ;

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/ml/polyml/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/ml/polyml/extensions.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/ml/polyml/extensions.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,6 +4,8 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
+lib [] ;
+
 structure CastReal : CAST_REAL where type t = Real.t = struct
    open Real
    structure Bits = Word

Modified: mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/extensions.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/extensions.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/ml/smlnj/extensions.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -6,7 +6,4 @@
 
 if CM.make "$c/c.cm" then () else fail "Couldn't make ML-NLFFI" ;
 
-UseLib.Trace.disabled
-(fn () =>
-    (use "detail/ml/smlnj/cast-real.sml"
-   ; use "detail/ml/smlnj/pack-real.sml")) ;
+lib ["cast-real.sml", "pack-real.sml"] ;

Modified: mltonlib/trunk/com/ssh/generic/unstable/lib-with-default.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/lib-with-default.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/generic/unstable/lib-with-default.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,12 +4,12 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["lib.use"],
-     self = ["with/generic.sml",
-             "with/eq.sml",
-             "with/type-hash.sml",
-             "with/type-info.sml",
-             "with/hash.sml",
-             "with/ord.sml",
-             "with/pretty.sml",
-             "with/close-pretty-with-extra.sml"]} ;
+lib ["lib.use",
+     "with/generic.sml",
+     "with/eq.sml",
+     "with/type-hash.sml",
+     "with/type-info.sml",
+     "with/hash.sml",
+     "with/ord.sml",
+     "with/pretty.sml",
+     "with/close-pretty-with-extra.sml"] ;

Modified: mltonlib/trunk/com/ssh/generic/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/generic/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,75 +4,75 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../../../org/mlton/vesak/ds/unstable/lib.use",
-             "../../extended-basis/unstable/basis.use",
-             "../../prettier/unstable/lib.use",
-             "../../random/unstable/lib.use"],
-     self = ["detail/ml/common/cast-real.sig",
-             "detail/ml/${SML_COMPILER}/extensions.use",
-             "public/framework/generics.sig",
-             "detail/util/sml-syntax.sml",
-             "detail/framework/generics.sml",
-             "public/framework/ty.sig",
-             "detail/framework/ty.sml",
-             "public/framework/closed-rep.sig",
-             "public/framework/closed-cases.sig",
-             "public/framework/open-rep.sig",
-             "public/framework/open-cases.sig",
-             "public/framework/cases.sig",
-             "public/framework/generic.sig",
-             "public/util/generics-util.sig",
-             "detail/util/generics-util.sml",
-             "detail/util/ops.sml",
-             "detail/util/opt-int.sml",
-             "detail/util/hash-univ.sml",
-             "detail/framework/mk-closed-rep.fun",
-             "detail/framework/root-generic.sml",
-             "detail/framework/close-generic.fun",
-             "public/framework/layered-rep.sig",
-             "public/framework/layer-dep-cases-fun.sig",
-             "public/framework/layer-cases-fun.sig",
-             "public/framework/layer-rep-fun.sig",
-             "detail/framework/layer-generic.fun",
-             "public/value/type-info.sig",
-             "detail/value/type-info.sml",
-             "public/value/data-rec-info.sig",
-             "detail/value/data-rec-info.sml",
-             "public/value/type-hash.sig",
-             "detail/value/type-hash.sml",
-             "public/value/hash.sig",
-             "detail/value/hash.sml",
-             "public/value/some.sig",
-             "detail/value/some.sml",
-             "public/value/arbitrary.sig",
-             "detail/value/arbitrary.sml",
-             "detail/value/debug.sml",
-             "public/value/dynamic.sig",
-             "detail/value/dynamic.sml",
-             "public/value/eq.sig",
-             "detail/value/eq.sml",
-             "public/value/fmap.sig",
-             "detail/value/fmap.sml",
-             "public/value/ord.sig",
-             "detail/value/ord.sml",
-             "public/value/pickle.sig",
-             "detail/value/pickle.sml",
-             "public/value/pretty.sig",
-             "detail/value/pretty.sml",
-             "public/value/reduce.sig",
-             "detail/value/reduce.sml",
-             "public/value/seq.sig",
-             "detail/value/seq.sml",
-             "public/value/size.sig",
-             "detail/value/size.sml",
-             "public/value/shrink.sig",
-             "detail/value/shrink.sml",
-             "public/value/transform.sig",
-             "detail/value/transform.sml",
-             "public/value/type-exp.sig",
-             "detail/value/type-exp.sml",
-             "public/extra/generic-extra.sig",
-             "detail/extra/with-extra.fun",
-             "detail/extra/close-pretty-with-extra.fun",
-             "detail/extra/reg-basis-exns.fun",
-             "public/export.sml"]} ;
+lib ["../../../../org/mlton/vesak/ds/unstable/lib.use",
+     "../../extended-basis/unstable/basis.use",
+     "../../prettier/unstable/lib.use",
+     "../../random/unstable/lib.use",
+     "detail/ml/common/cast-real.sig",
+     "detail/ml/${SML_COMPILER}/extensions.use",
+     "public/framework/generics.sig",
+     "detail/util/sml-syntax.sml",
+     "detail/framework/generics.sml",
+     "public/framework/ty.sig",
+     "detail/framework/ty.sml",
+     "public/framework/closed-rep.sig",
+     "public/framework/closed-cases.sig",
+     "public/framework/open-rep.sig",
+     "public/framework/open-cases.sig",
+     "public/framework/cases.sig",
+     "public/framework/generic.sig",
+     "public/util/generics-util.sig",
+     "detail/util/generics-util.sml",
+     "detail/util/ops.sml",
+     "detail/util/opt-int.sml",
+     "detail/util/hash-univ.sml",
+     "detail/framework/mk-closed-rep.fun",
+     "detail/framework/root-generic.sml",
+     "detail/framework/close-generic.fun",
+     "public/framework/layered-rep.sig",
+     "public/framework/layer-dep-cases-fun.sig",
+     "public/framework/layer-cases-fun.sig",
+     "public/framework/layer-rep-fun.sig",
+     "detail/framework/layer-generic.fun",
+     "public/value/type-info.sig",
+     "detail/value/type-info.sml",
+     "public/value/data-rec-info.sig",
+     "detail/value/data-rec-info.sml",
+     "public/value/type-hash.sig",
+     "detail/value/type-hash.sml",
+     "public/value/hash.sig",
+     "detail/value/hash.sml",
+     "public/value/some.sig",
+     "detail/value/some.sml",
+     "public/value/arbitrary.sig",
+     "detail/value/arbitrary.sml",
+     "detail/value/debug.sml",
+     "public/value/dynamic.sig",
+     "detail/value/dynamic.sml",
+     "public/value/eq.sig",
+     "detail/value/eq.sml",
+     "public/value/fmap.sig",
+     "detail/value/fmap.sml",
+     "public/value/ord.sig",
+     "detail/value/ord.sml",
+     "public/value/pickle.sig",
+     "detail/value/pickle.sml",
+     "public/value/pretty.sig",
+     "detail/value/pretty.sml",
+     "public/value/reduce.sig",
+     "detail/value/reduce.sml",
+     "public/value/seq.sig",
+     "detail/value/seq.sml",
+     "public/value/size.sig",
+     "detail/value/size.sml",
+     "public/value/shrink.sig",
+     "detail/value/shrink.sml",
+     "public/value/transform.sig",
+     "detail/value/transform.sml",
+     "public/value/type-exp.sig",
+     "detail/value/type-exp.sml",
+     "public/extra/generic-extra.sig",
+     "detail/extra/with-extra.fun",
+     "detail/extra/close-pretty-with-extra.fun",
+     "detail/extra/reg-basis-exns.fun",
+     "public/export.sml"] ;

Modified: mltonlib/trunk/com/ssh/generic/unstable/test.use
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/test.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/generic/unstable/test.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,35 +4,35 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../extended-basis/unstable/basis.use",
-             "../../unit-test/unstable/lib.use",
-             "lib.use",
-             "../../prettier/unstable/lib.use",
-             "../../random/unstable/lib.use"],
-     self = ["with/generic.sml",
-             "with/type-info.sml",
-             "with/type-hash.sml",
-             "with/hash.sml",
-             "with/pretty.sml",
-             "with/eq.sml",
-             "with/data-rec-info.sml",
-             "with/some.sml",
-             "with/pickle.sml",
-             "with/seq.sml",
-             "with/reduce.sml",
-             "with/transform.sml",
-             "with/fmap.sml",
-             "with/arbitrary.sml",
-             "with/size.sml",
-             "with/ord.sml",
-             "with/shrink.sml",
-             "with/close-pretty-with-extra.sml",
-             "with/reg-basis-exns.sml",
-             "../../unit-test/unstable/with/unit-test.sml",
-             "test/utils.fun",
-             "test/fmap.sml",
-             "test/pickle.sml",
-             "test/pretty.sml",
-             "test/reduce.sml",
-             "test/some.sml",
-             "test/transform.sml"]} ;
+lib ["../../extended-basis/unstable/basis.use",
+     "../../unit-test/unstable/lib.use",
+     "lib.use",
+     "../../prettier/unstable/lib.use",
+     "../../random/unstable/lib.use",
+     "with/generic.sml",
+     "with/type-info.sml",
+     "with/type-hash.sml",
+     "with/hash.sml",
+     "with/pretty.sml",
+     "with/eq.sml",
+     "with/data-rec-info.sml",
+     "with/some.sml",
+     "with/pickle.sml",
+     "with/seq.sml",
+     "with/reduce.sml",
+     "with/transform.sml",
+     "with/fmap.sml",
+     "with/arbitrary.sml",
+     "with/size.sml",
+     "with/ord.sml",
+     "with/shrink.sml",
+     "with/close-pretty-with-extra.sml",
+     "with/reg-basis-exns.sml",
+     "../../unit-test/unstable/with/unit-test.sml",
+     "test/utils.fun",
+     "test/fmap.sml",
+     "test/pickle.sml",
+     "test/pretty.sml",
+     "test/reduce.sml",
+     "test/some.sml",
+     "test/transform.sml"] ;

Modified: mltonlib/trunk/com/ssh/prettier/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/prettier/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/prettier/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,8 +4,8 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../extended-basis/unstable/basis.use"],
-     self = ["public/prettier.sig",
-             "detail/prettier.sml",
-             "public/export.sml",
-             "public/infixes.sml"]} ;
+lib ["../../extended-basis/unstable/basis.use",
+     "public/prettier.sig",
+     "detail/prettier.sml",
+     "public/export.sml",
+     "public/infixes.sml"] ;

Modified: mltonlib/trunk/com/ssh/random/unstable/detail/ml/polyml/random-dev.use
===================================================================
--- mltonlib/trunk/com/ssh/random/unstable/detail/ml/polyml/random-dev.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/random/unstable/detail/ml/polyml/random-dev.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -5,6 +5,4 @@
  *)
 
 (* XXX implement better seed/useed for Poly/ML *)
-UseLib.Trace.disabled
-(fn () =>
-    use "detail/ml/common/random-dev.sml") ;
+lib ["../common/random-dev.sml"] ;

Modified: mltonlib/trunk/com/ssh/random/unstable/detail/ml/smlnj/random-dev.use
===================================================================
--- mltonlib/trunk/com/ssh/random/unstable/detail/ml/smlnj/random-dev.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/random/unstable/detail/ml/smlnj/random-dev.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -5,6 +5,4 @@
  *)
 
 (* XXX implement better seed/useed for SML/NJ *)
-UseLib.Trace.disabled
-(fn () =>
-    use "detail/ml/common/random-dev.sml") ;
+lib ["../common/random-dev.sml"] ;

Modified: mltonlib/trunk/com/ssh/random/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/random/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/random/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,13 +4,13 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../extended-basis/unstable/basis.use"],
-     self = ["public/rng.sig",
-             "public/random-gen.sig",
-             "detail/mk-random-gen.fun",
-             "public/numerical-recipes.sig",
-             "detail/numerical-recipes.sml",
-             "detail/ranqd1-gen.sml",
-             "public/random-dev.sig",
-             "detail/ml/${SML_COMPILER}/random-dev.use",
-             "public/export.sml"]} ;
+lib ["../../extended-basis/unstable/basis.use",
+     "public/rng.sig",
+     "public/random-gen.sig",
+     "detail/mk-random-gen.fun",
+     "public/numerical-recipes.sig",
+     "detail/numerical-recipes.sml",
+     "detail/ranqd1-gen.sml",
+     "public/random-dev.sig",
+     "detail/ml/${SML_COMPILER}/random-dev.use",
+     "public/export.sml"] ;

Modified: mltonlib/trunk/com/ssh/unit-test/unstable/example.use
===================================================================
--- mltonlib/trunk/com/ssh/unit-test/unstable/example.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/unit-test/unstable/example.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,11 +4,11 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["lib-with-default.use",
-             "../../extended-basis/unstable/basis.use",
-             "../../generic/unstable/lib.use",
-             "../../random/unstable/lib.use"],
-     self = ["detail/sorted-list.sml", (* XXX this is also used in the library? *)
-             "example/assoc-test.sml",
-             "example/innocent.sml",
-             "example/qc-test.sml"]} ;
+lib ["lib-with-default.use",
+     "../../extended-basis/unstable/basis.use",
+     "../../generic/unstable/lib.use",
+     "../../random/unstable/lib.use",
+     "detail/sorted-list.sml", (* XXX this is also used in the library? *)
+     "example/assoc-test.sml",
+     "example/innocent.sml",
+     "example/qc-test.sml"] ;

Modified: mltonlib/trunk/com/ssh/unit-test/unstable/lib-with-default.use
===================================================================
--- mltonlib/trunk/com/ssh/unit-test/unstable/lib-with-default.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/unit-test/unstable/lib-with-default.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,12 +4,12 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../extended-basis/unstable/basis.use",
-             "../../generic/unstable/lib-with-default.use",
-             "../../random/unstable/lib.use",
-             "lib.use"],
-     self = ["../../generic/unstable/with/arbitrary.sml",
-             "../../generic/unstable/with/size.sml",
-             "../../generic/unstable/with/shrink.sml",
-             "../../generic/unstable/with/close-pretty-with-extra.sml",
-             "with/unit-test.sml"]} ;
+lib ["../../extended-basis/unstable/basis.use",
+     "../../generic/unstable/lib-with-default.use",
+     "../../random/unstable/lib.use",
+     "lib.use",
+     "../../generic/unstable/with/arbitrary.sml",
+     "../../generic/unstable/with/size.sml",
+     "../../generic/unstable/with/shrink.sml",
+     "../../generic/unstable/with/close-pretty-with-extra.sml",
+     "with/unit-test.sml"] ;

Modified: mltonlib/trunk/com/ssh/unit-test/unstable/lib.use
===================================================================
--- mltonlib/trunk/com/ssh/unit-test/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/com/ssh/unit-test/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,14 +4,14 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../extended-basis/unstable/basis.use",
-             "../../generic/unstable/lib.use",
-             "../../prettier/unstable/lib.use",
-             "../../random/unstable/lib.use"],
-     self = ["detail/sorted-list.sml",
-             "public/unit-test.sig",
-             "public/mk-unit-test-fun.sig",
-             "detail/fru.sml",
-             "detail/maybe.sml",
-             "detail/mk-unit-test.fun",
-             "public/export.sml"]} ;
+lib ["../../extended-basis/unstable/basis.use",
+     "../../generic/unstable/lib.use",
+     "../../prettier/unstable/lib.use",
+     "../../random/unstable/lib.use",
+     "detail/sorted-list.sml",
+     "public/unit-test.sig",
+     "public/mk-unit-test-fun.sig",
+     "detail/fru.sml",
+     "detail/maybe.sml",
+     "detail/mk-unit-test.fun",
+     "public/export.sml"] ;

Modified: mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use
===================================================================
--- mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/org/mlton/vesak/ds/unstable/lib.use	2007-11-19 13:33:37 UTC (rev 6175)
@@ -4,14 +4,14 @@
  * See the LICENSE file or http://mlton.org/License for details.
  *)
 
-lib {reqs = ["../../../../../com/ssh/extended-basis/unstable/basis.use"],
-     self = ["public/node.sig",
-             "detail/node.sml",
-             "public/queue.sig",
-             "public/linked-queue.sig",
-             "detail/linked-queue.sml",
-             "public/unlinkable-list.sig",
-             "detail/unlinkable-list.sml",
-             "public/hash-map.sig",
-             "detail/hash-map.sml",
-             "public/export.sml"]} ;
+lib ["../../../../../com/ssh/extended-basis/unstable/basis.use",
+     "public/node.sig",
+     "detail/node.sml",
+     "public/queue.sig",
+     "public/linked-queue.sig",
+     "detail/linked-queue.sml",
+     "public/unlinkable-list.sig",
+     "detail/unlinkable-list.sml",
+     "public/hash-map.sig",
+     "detail/hash-map.sml",
+     "public/export.sml"] ;

Modified: mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/ml/alice/workarounds.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/ml/alice/workarounds.sml	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/ml/alice/workarounds.sml	2007-11-19 13:33:37 UTC (rev 6175)
@@ -33,7 +33,7 @@
                            else case Path.splitDirFile p
                                  of {dir, file} =>
                                     (if "" <> dir then chDir dir else ()
-                                   ; Path.joinDirFile {dir = dir, file = file}),
+                                   ; Path.joinDirFile {dir = getDir (), file = file}),
                         fn () => chDir cwd)
       end
    end

Modified: mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/use-lib.sml
===================================================================
--- mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/use-lib.sml	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/org/mlton/vesak/use-lib/unstable/detail/use-lib.sml	2007-11-19 13:33:37 UTC (rev 6175)
@@ -13,110 +13,100 @@
 
    fun error strs = raise Fail (concat strs)
 
-   val vars = ref [("SML_COMPILER", ${SML_COMPILER})]
+   structure Var = struct
+      val vars = ref [("SML_COMPILER", ${SML_COMPILER})]
 
-   fun getVar var =
-       case List.find (fn (i, _) => i = var) (!vars)
-        of SOME (_, v) => v
-         | NONE =>
-           case OS.Process.getEnv var
-            of NONE   => error ["Undefined variable: ", var]
-             | SOME v => v
+      fun get var =
+          case List.find (fn (i, _) => i = var) (!vars)
+           of SOME (_, v) => v
+            | NONE =>
+              case OS.Process.getEnv var
+               of NONE   => error ["Undefined variable: ", var]
+                | SOME v => v
 
-   fun expandVars path = let
-      fun outside os =
-       fn #"$" :: #"{" :: is => inside os [] is
-        | c            :: is => outside (c::os) is
-        |                 [] => implode (rev os)
-      and inside os vs =
-       fn #"}" :: is => outside os (explode (getVar (implode (rev vs))) @ is)
-        | c    :: is => inside os (c::vs) is
-        |         [] => error ["Unclosed variable reference"]
+      fun expand path = let
+         fun outside os =
+          fn #"$" :: #"{" :: is => inside os [] is
+           | c            :: is => outside (c::os) is
+           |                 [] => implode (rev os)
+         and inside os vs =
+          fn #"}" :: is => outside os (explode (get (implode (rev vs))) @ is)
+           | c    :: is => inside os (c::vs) is
+           |         [] => error ["Unclosed variable reference"]
+      in
+         outside [] (explode path)
+      end
+   end
+
+   local
+      type entry = {path : string, loading : string list}
+      val libStack : entry list list ref = ref []
+      val useQueue : entry list ref = ref []
    in
-      outside [] (explode path)
+      fun pushUse e = useQueue := !useQueue @ [e]
+      fun popUse () =
+          case !useQueue
+           of [] => error ["Each lib must be used as a unique .use file"]
+            | e::es => (useQueue := es ; e)
+      fun pushLib () =
+          (libStack := !useQueue :: !libStack
+         ; useQueue := [])
+      fun popLib () =
+          case !libStack
+           of [] => error ["Internal error: Unmatched popLib"]
+            | e::es => (libStack := es
+                      ; useQueue := !useQueue @ e)
+      fun clear () = (libStack := [] ; useQueue := [])
    end
 
-   val using : string option ref = ref NONE
-
-   fun useNoTrace path = let
-      val path = expandVars path
+   fun useLoading loading path = let
+      val path = Var.expand path
       val () = if OS.FileSys.access (path, [OS.FileSys.A_READ])
                then ()
-               else error ["Unreadable file: ", path]
+               else error ["File ", path, " is unreadable from ",
+                           OS.FileSys.getDir ()]
       val path = OS.FileSys.fullPath path
-      val oldUsing = !using
    in
-      using := SOME path
-    ; after (fn () => use path,
-             fn () => using := oldUsing)
+      if not (String.isSuffix ".use" path)
+      then ()
+      else if List.exists (fn p => path = p) loading
+      then error ("Cyclic library dependency: "::
+                  foldl (fn (p, ps) => p::" -> "::ps) [path] loading)
+      else pushUse {path = path, loading = loading}
+    ; use path
    end
 
-   structure Trace = struct
-      local
-         val theTrace : string list ref = ref []
-         val traceRoot : string option ref = ref NONE
-         fun scoped t th =
-             case !traceRoot
-              of old => (traceRoot := t
-                       ; after (th, fn () => traceRoot := old))
+   local
+      val loaded : string list ref = ref []
+   in
+      fun lib paths = let
+         val {path, loading} = popUse ()
       in
-         fun load path =
-             scoped (SOME (OS.FileSys.getDir ()))
-                    (fn () => (useNoTrace path
-                             ; rev (!theTrace) before theTrace := []))
-
-         fun fmt {expandVars = e} = let
-            val expandVars = if e then expandVars else fn x => x
-         in
-            concat o List.concat o
-            map (fn path => ["use \"", expandVars path, "\" ;\n"])
-         end
-
-         fun disabled th = scoped NONE th
-
-         fun trace path =
-             case !traceRoot
-              of NONE => ()
-               | SOME root =>
-                 theTrace := OS.Path.joinDirFile
-                                {dir = OS.Path.mkRelative
-                                          {path = OS.FileSys.getDir (),
-                                           relativeTo = root},
-                                 file = path} :: !theTrace
+         if List.exists (fn p => path = p) (!loaded)
+         then ()
+         else let
+               val dir = OS.Path.mkRelative
+                            {path = OS.Path.dir path,
+                             relativeTo = OS.FileSys.getDir ()}
+               val cv = ${SILENT}
+               val loading = path :: loading
+            in
+               pushLib ()
+             ; after (fn () =>
+                         (app (fn file =>
+                                  useLoading
+                                     loading
+                                     (OS.Path.concat (dir, file))) paths
+                        ; loaded := path :: !loaded),
+                      fn () =>
+                         (popLib ()
+                        ; ${VERBOSE} cv))
+            end
       end
    end
 
-   open Trace
+   val use = useLoading []
 
-   fun use path = (trace path ; useNoTrace path)
-
-   val loading : string list ref = ref []
-   val loaded : string list ref = ref []
-
-   fun lib {reqs, self} =
-       case !using
-        of NONE      => error ["Current file unknown"]
-         | SOME path =>
-           if List.exists (fn p => path = p) (!loaded)
-           then ()
-           else if List.exists (fn p => path = p) (!loading)
-           then error ("Cyclic library dependency: " ::
-                       foldl (fn (p, ps) => p::" -> "::ps) [path] (!loading))
-           else let
-                 val cwd = OS.FileSys.getDir ()
-                 val dir = OS.Path.dir path
-                 val () = OS.FileSys.chDir dir
-                 val cv = ${SILENT}
-                 val was = !loading
-              in
-                 loading := path :: was
-               ; after (fn () =>
-                           (app useNoTrace reqs
-                          ; app use self
-                          ; loaded := path :: !loaded),
-                        fn () =>
-                           (${VERBOSE} cv
-                          ; loading := was
-                          ; OS.FileSys.chDir cwd))
-              end
+   val use = fn path => use path handle e => (clear () ; raise e)
+   val lib = fn paths => lib paths handle e => (clear () ; raise e)
 end

Modified: mltonlib/trunk/org/mlton/vesak/use-lib/unstable/public/use-lib.sig
===================================================================
--- mltonlib/trunk/org/mlton/vesak/use-lib/unstable/public/use-lib.sig	2007-11-18 23:21:13 UTC (rev 6174)
+++ mltonlib/trunk/org/mlton/vesak/use-lib/unstable/public/use-lib.sig	2007-11-19 13:33:37 UTC (rev 6175)
@@ -9,11 +9,10 @@
  * library definition framework.
  *)
 signature USE_LIB = sig
-   val lib : {reqs : string list,
-              self : string list} -> unit
+   val lib : string list -> unit
    (**
-    * Defines a library that depends on the {reqs} libraries and is
-    * implemented by the {self} files.
+    * Defines a library composed of the specified libraries and source
+    * files.
     *)
 
    val use : string -> unit
@@ -21,18 +20,4 @@
     * Loads the specified library or uses the specified source file.
     * Environment variable references are allowed within the path.
     *)
-
-   (**
-    * Interface for recording flat traces of library loading.
-    *)
-   structure Trace : sig
-      val load : string -> string list
-      (** Load the specified library and return a list of used files. *)
-
-      val fmt : {expandVars : bool} -> string list -> string
-      (** Formats given trace as a flat use file. *)
-
-      val disabled : (unit -> 'a) -> 'a
-      (** Invoke thunk with trace disabled. *)
-   end
 end




More information about the MLton-commit mailing list