[svn] r6095: nemerle/trunk/lib/option.n
malekith
svnadmin at nemerle.org
Mon Jan 30 13:04:19 CET 2006
Log:
Add Value and HasValue in style of Nullable.
Author: malekith
Date: Mon Jan 30 13:04:18 2006
New Revision: 6095
Modified:
nemerle/trunk/lib/option.n
Modified: nemerle/trunk/lib/option.n
==============================================================================
--- nemerle/trunk/lib/option.n (original)
+++ nemerle/trunk/lib/option.n Mon Jan 30 13:04:18 2006
@@ -87,6 +87,22 @@
| None => val
}
}
+
+ public HasValue : bool
+ {
+ get { this is Some (_) }
+ }
+
+ public Value : 'a
+ {
+ get {
+ match (this) {
+ | Some (x) => x
+ | None =>
+ throw System.ArgumentException ("option.Value")
+ }
+ }
+ }
}
More information about the svn
mailing list