aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2019-01-24 23:49:52 -0400
committerEduardo Julian2019-01-24 23:49:52 -0400
commita8851787291a0dcf41e28da829299c9102a15643 (patch)
treedd0e076d2bd2211eb923e29af194fa51c9344266
parent23f9d5e4193e13111a9905863321f476c437451a (diff)
Some documentation for dynamic typing.
-rw-r--r--stdlib/source/lux/type/dynamic.lux6
1 files changed, 5 insertions, 1 deletions
diff --git a/stdlib/source/lux/type/dynamic.lux b/stdlib/source/lux/type/dynamic.lux
index d57669213..6fb83f8fb 100644
--- a/stdlib/source/lux/type/dynamic.lux
+++ b/stdlib/source/lux/type/dynamic.lux
@@ -16,7 +16,7 @@
["Actual" (%type actual)]))
(abstract: #export Dynamic
- {}
+ {#.doc "A value coupled with its type, so it can be checked later."}
[Type Any]
@@ -24,11 +24,15 @@
(def: dynamic-representation (-> Dynamic [Type Any]) (|>> :representation))
(syntax: #export (:dynamic value)
+ {#.doc (doc (: Dynamic
+ (:dynamic 123)))}
(with-gensyms [g!value]
(wrap (list (` (let [(~ g!value) (~ value)]
((~! ..dynamic-abstraction) [(:of (~ g!value)) (~ g!value)])))))))
(syntax: #export (:check type value)
+ {#.doc (doc (: (error.Error Nat)
+ (:check Nat (:dynamic 123))))}
(with-gensyms [g!type g!value]
(wrap (list (` (let [[(~ g!type) (~ g!value)] ((~! ..dynamic-representation) (~ value))]
(: ((~! error.Error) (~ type))