From a8851787291a0dcf41e28da829299c9102a15643 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 24 Jan 2019 23:49:52 -0400 Subject: Some documentation for dynamic typing. --- stdlib/source/lux/type/dynamic.lux | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'stdlib/source') 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)) -- cgit v1.2.3