[MLton-commit] r4799
Vesa Karvonen
vesak at mlton.org
Wed Nov 1 04:30:36 PST 2006
Started "exporting" basic utilities.
----------------------------------------------------------------------
A mltonlib/trunk/com/ssh/basic/
A mltonlib/trunk/com/ssh/basic/unstable/
A mltonlib/trunk/com/ssh/basic/unstable/basic.mlb
A mltonlib/trunk/com/ssh/basic/unstable/detail/
A mltonlib/trunk/com/ssh/basic/unstable/detail/exit.sml
A mltonlib/trunk/com/ssh/basic/unstable/public/
A mltonlib/trunk/com/ssh/basic/unstable/public/exit.sig
A mltonlib/trunk/com/ssh/basic/unstable/public/export.sml
A mltonlib/trunk/com/ssh/basic/unstable/readme.txt
----------------------------------------------------------------------
Added: mltonlib/trunk/com/ssh/basic/unstable/basic.mlb
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/basic.mlb 2006-10-31 14:45:16 UTC (rev 4798)
+++ mltonlib/trunk/com/ssh/basic/unstable/basic.mlb 2006-11-01 12:30:33 UTC (rev 4799)
@@ -0,0 +1,22 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+local
+ $(MLTON_LIB)/com/ssh/extended-basis/unstable/basis.mlb
+in
+ ann
+ "forceUsed"
+ "sequenceNonUnit warn"
+ "warnUnused true"
+ in
+ local
+ public/exit.sig
+ detail/exit.sml
+ in
+ public/export.sml
+ end
+ end
+end
Property changes on: mltonlib/trunk/com/ssh/basic/unstable/basic.mlb
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/com/ssh/basic/unstable/detail/exit.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/detail/exit.sml 2006-10-31 14:45:16 UTC (rev 4798)
+++ mltonlib/trunk/com/ssh/basic/unstable/detail/exit.sml 2006-11-01 12:30:33 UTC (rev 4799)
@@ -0,0 +1,18 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Exit :> EXIT = struct
+ type 'a t = 'a -> exn
+
+ fun within block = let
+ exception EscapedExit of 'a
+ in
+ block EscapedExit
+ handle EscapedExit value => value
+ end
+
+ fun to exit value = raise exit value
+end
Property changes on: mltonlib/trunk/com/ssh/basic/unstable/detail/exit.sml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/com/ssh/basic/unstable/public/exit.sig
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/exit.sig 2006-10-31 14:45:16 UTC (rev 4798)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/exit.sig 2006-11-01 12:30:33 UTC (rev 4799)
@@ -0,0 +1,50 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+(**
+ * Signature for exit (or escape) handlers.
+ *
+ * Note the type of the {to} function. The return type of {to} is a type
+ * variable that only appears as the return type. This means that the
+ * {to} function doesn't return normally to the caller and that you can
+ * call it from a context of any type.
+ *)
+signature EXIT = sig
+ type 'a t
+ (** The type of exits. *)
+
+ val within : ('a t -> 'a) -> 'a
+ (**
+ * Sets up an exit and passes it to the given function. The function
+ * may then either return normally or by calling {to} with the exit and
+ * a return value. For example,
+ *
+ *> Exit.within
+ *> (fn l =>
+ *> if condition then
+ *> Exit.to l 1
+ *> else
+ *> 2)
+ *
+ * evaluates either to {1} or to {2} depending on the {condition}.
+ *
+ * Note that the function receiving the exit is called from a non-tail
+ * position.
+ *)
+
+ val to : 'a t -> 'a -> 'b
+ (**
+ * {to l v} returns from the {within} invocation that introduced the
+ * exit {l} with the value {v}.
+ *
+ * Note that {to} works by raising an exception. The exception can be
+ * caught by a wildcard exception handler. Wildcard exception handlers
+ * should usually reraise the exception after performing their effects.
+ * Also, if the {within} invocation that introduced the exit {l} has
+ * already returned, the effect is (still) that an exception will be
+ * raised.
+ *)
+end
Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/exit.sig
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/com/ssh/basic/unstable/public/export.sml
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/public/export.sml 2006-10-31 14:45:16 UTC (rev 4798)
+++ mltonlib/trunk/com/ssh/basic/unstable/public/export.sml 2006-11-01 12:30:33 UTC (rev 4799)
@@ -0,0 +1,7 @@
+(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Exit :> EXIT = Exit
Property changes on: mltonlib/trunk/com/ssh/basic/unstable/public/export.sml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: mltonlib/trunk/com/ssh/basic/unstable/readme.txt
===================================================================
--- mltonlib/trunk/com/ssh/basic/unstable/readme.txt 2006-10-31 14:45:16 UTC (rev 4798)
+++ mltonlib/trunk/com/ssh/basic/unstable/readme.txt 2006-11-01 12:30:33 UTC (rev 4799)
@@ -0,0 +1,56 @@
+Basic Utilities Library
+-----------------------
+
+ This library implements basic utilities for SML programming that one
+ could reasonably consider to be a part of the language.
+
+
+Info
+----
+
+ License: MLton-LICENSE
+ Portability: portable
+ Stability: experimental
+ Maintainer: Vesa Karvonen <vesa.karvonen at cs.helsinki.fi>
+
+
+About Library Organization
+--------------------------
+
+ public/
+
+ This directory contains the documented signature definitions (*.sig)
+ and listings of all top-level bindings exported by this library
+ (export.sml). The contents of this directory should be sufficient
+ to understand what is provided by this library.
+
+ basic.{cm,mlb,use}
+
+ These build files define the library. See the build files for
+ further instructions.
+
+ detail/
+
+ This directory contains the implementation details of the library.
+
+
+Contributions
+-------------
+
+ The signatures and structures defined by this library are not meant to
+ be cast in stone! We welcome contributions including new utilities,
+ bugfixes, and ports to new compilers. The recommended submit method
+ for small contributions to this library is to send a message with a
+ brief description of the proposed contribution as well as a patch
+ containing full code and documentation (signature comments) to either
+ the MLton-user list
+
+ mlton-user at mlton.org
+
+ or the MLton list
+
+ mlton at mlton.org .
+
+ For larger extensions or changes we recommend that you first contact
+ the active maintainer(s) of this library. The preferred contact method
+ is through the above mailing lists.
Property changes on: mltonlib/trunk/com/ssh/basic/unstable/readme.txt
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the MLton-commit
mailing list