diff options
Diffstat (limited to 'stdlib/source/library/lux/type/dynamic.lux')
-rw-r--r-- | stdlib/source/library/lux/type/dynamic.lux | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 80bc06a84..d08962051 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -11,7 +11,7 @@ [text ["%" format]]] [macro (.only with_symbols) - ["[0]" syntax (.only syntax:)]] + ["[0]" syntax (.only syntax)]] ["[0]" type (.only) ["[0]" primitive (.only primitive:)]]]]) @@ -32,20 +32,22 @@ (-> Dynamic [Type Any]) (|>> primitive.representation)) - (syntax: .public (dynamic [value <code>.any]) - (with_symbols [g!value] - (in (list (` (.let [(~ g!value) (~ value)] - ((~! ..abstraction) [(.type_of (~ g!value)) (~ g!value)]))))))) + (def: .public dynamic + (syntax (_ [value <code>.any]) + (with_symbols [g!value] + (in (list (` (.let [(~ g!value) (~ value)] + ((~! ..abstraction) [(.type_of (~ g!value)) (~ g!value)])))))))) - (syntax: .public (static [type <code>.any - value <code>.any]) - (with_symbols [g!type g!value] - (in (list (` (.let [[(~ g!type) (~ g!value)] ((~! ..representation) (~ value))] - (.is ((~! try.Try) (~ type)) - (.if (.at (~! type.equivalence) (~' =) - (.type (~ type)) (~ g!type)) - {try.#Success (.as (~ type) (~ g!value))} - ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)]))))))))) + (def: .public static + (syntax (_ [type <code>.any + value <code>.any]) + (with_symbols [g!type g!value] + (in (list (` (.let [[(~ g!type) (~ g!value)] ((~! ..representation) (~ value))] + (.is ((~! try.Try) (~ type)) + (.if (.at (~! type.equivalence) (~' =) + (.type (~ type)) (~ g!type)) + {try.#Success (.as (~ type) (~ g!value))} + ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)])))))))))) (def: .public (format value) (-> Dynamic (Try Text)) |