diff options
Diffstat (limited to '')
43 files changed, 359 insertions, 359 deletions
diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 0ed495c31..0ed65378d 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -64,7 +64,7 @@ syntheses extensionL.all-syntheses annsI (expressionT.translate (expressionS.synthesize syntheses annsA)) annsV (evalT.eval annsI)] - (wrap [annsI (:! Code annsV)]))) + (wrap [annsI (:coerce Code annsV)]))) (def: (switch-compiler new-compiler) (-> Lux (Meta Aliases)) @@ -107,7 +107,7 @@ (&.throw Invalid-Macro (%code code))) expansion (: (Meta (List Code)) (function (_ compiler) - (case (macroL.expand (:! Macro _macroV) argsC+ compiler) + (case (macroL.expand (:coerce Macro _macroV) argsC+ compiler) (#e.Error error) ((&.throw Macro-Expansion-Failed error) compiler) @@ -167,7 +167,7 @@ (def: text-to-blob (-> Text Blob) - (|>> (:! String) + (|>> (:coerce String) (String::getBytes ["UTF-8"]) e.assume)))}) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp.lux b/new-luxc/source/luxc/lang/translation/common-lisp.lux index 36926833c..4341e5e4c 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp.lux @@ -83,26 +83,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -114,7 +114,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -122,15 +122,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -140,7 +140,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -150,7 +150,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -160,13 +160,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -190,7 +190,7 @@ (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (_.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (_.expression code))] module-buffer)]] (load! code))) @@ -203,7 +203,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux index d132ba0b8..41e93c13b 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux @@ -37,7 +37,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (_.int (:! Int idx))))) + (method source (_.int (:coerce Int idx))))) valueO pathP)))) @@ -116,21 +116,21 @@ (meta/wrap (_.when (|> value <format> (<=> cursor-top) _.not) fail-pm!))) ([#.Bool _.bool _.equal] - [#.Nat (<| _.int (:! Int)) _.=] + [#.Nat (<| _.int (:coerce Int)) _.=] [#.Int _.int _.=] - [#.Deg (<| _.int (:! Int)) _.=] + [#.Deg (<| _.int (:coerce Int)) _.=] [#.Frac _.float _.=] [#.Text _.string _.equal]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (_.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (_.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (_.progn (list (_.setq! $temp (runtimeT.sum//get cursor-top (_.int (:! Int idx)) <flag>)) + (meta/wrap (_.progn (list (_.setq! $temp (runtimeT.sum//get cursor-top (_.int (:coerce Int idx)) <flag>)) (_.if (_.null (@@ $temp)) fail-pm! (push-cursor! (@@ $temp))))))) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux index cb6f03d17..0108d2e83 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/eval.jvm.lux @@ -42,8 +42,8 @@ ) (exception: #export (Unknown-Kind-Of-Host-Object {host-object Object}) - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (format object-class " --- " text-representation))) (host.import org/armedbear/lisp/LispObject) @@ -72,21 +72,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) SimpleVector (Error Any)) - (let [size (:! Nat (SimpleVector::length [] host-object))] + (let [size (:coerce Nat (SimpleVector::length [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (lux-object (SimpleVector::elt [(:! Int idx)] host-object)) + (case (lux-object (SimpleVector::elt [(:coerce Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) (-> Nat Bool Any Any) - [(Long::intValue [] (:! Long tag)) + [(Long::intValue [] (:coerce Long tag)) (: Any (if flag //.unit @@ -101,52 +101,52 @@ (-> (-> Object (Error Any)) Cons (Error Any)) (let [variant-tag (Cons::car host-object)] (if (and (host.instance? org/armedbear/lisp/Symbol variant-tag) - (text/= //.variant-tag (Symbol::getName [] (:! Symbol variant-tag)))) + (text/= //.variant-tag (Symbol::getName [] (:coerce Symbol variant-tag)))) (do e.Monad<Error> - [#let [host-object (:! Cons (Cons::cdr host-object))] + [#let [host-object (:coerce Cons (Cons::cdr host-object))] tag (lux-object (Cons::car host-object)) - #let [host-object (:! Cons (Cons::cdr host-object))] + #let [host-object (:coerce Cons (Cons::cdr host-object))] #let [flag (host.instance? org/armedbear/lisp/SimpleString (Cons::car host-object))] value (lux-object (Cons::cdr host-object))] - (wrap (..variant (:! Nat tag) flag value))) - (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) + (wrap (..variant (:coerce Nat tag) flag value))) + (ex.throw invalid-variant (:coerce Text (Object::toString [] (:coerce Object host-object))))))) (def: (lux-object host-object) (-> Object (Error Any)) (cond (host.instance? org/armedbear/lisp/Bignum host-object) - (#e.Success (Bignum::longValue [] (:! Bignum host-object))) + (#e.Success (Bignum::longValue [] (:coerce Bignum host-object))) (host.instance? org/armedbear/lisp/Fixnum host-object) - (#e.Success (Fixnum::longValue [] (:! Fixnum host-object))) + (#e.Success (Fixnum::longValue [] (:coerce Fixnum host-object))) (host.instance? org/armedbear/lisp/DoubleFloat host-object) - (#e.Success (DoubleFloat::doubleValue [] (:! DoubleFloat host-object))) + (#e.Success (DoubleFloat::doubleValue [] (:coerce DoubleFloat host-object))) (host.instance? org/armedbear/lisp/Nil host-object) (#e.Success false) (host.instance? org/armedbear/lisp/Symbol host-object) - (if (is? Symbol::T (:! Symbol host-object)) + (if (is? Symbol::T (:coerce Symbol host-object)) (#e.Success true) - (ex.throw Unknown-Kind-Of-Host-Object (:! Object host-object))) + (ex.throw Unknown-Kind-Of-Host-Object (:coerce Object host-object))) (host.instance? org/armedbear/lisp/SimpleString host-object) - (#e.Success (SimpleString::getStringValue [] (:! SimpleString host-object))) + (#e.Success (SimpleString::getStringValue [] (:coerce SimpleString host-object))) (host.instance? org/armedbear/lisp/SimpleVector host-object) - (parse-tuple lux-object (:! SimpleVector host-object)) + (parse-tuple lux-object (:coerce SimpleVector host-object)) (host.instance? org/armedbear/lisp/Cons host-object) - (parse-variant lux-object (:! Cons host-object)) + (parse-variant lux-object (:coerce Cons host-object)) ## else - (ex.throw Unknown-Kind-Of-Host-Object (:! Object host-object)))) + (ex.throw Unknown-Kind-Of-Host-Object (:coerce Object host-object)))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux index 6bb4ec140..4e26c4218 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux @@ -15,11 +15,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) _.int meta/wrap)) + (|>> (:coerce Int) _.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) _.int meta/wrap)) + (|>> (:coerce Int) _.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux index 1819a8601..cd12328e2 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux @@ -33,7 +33,7 @@ (def: #export (variant tag last? value) (-> Nat Bool Expression Expression) - (variant' (_.int (:! Int tag)) (flag last?) value)) + (variant' (_.int (:coerce Int tag)) (flag last?) value)) (def: #export none Expression diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux index dab065e62..549142f3f 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/js.lux b/new-luxc/source/luxc/lang/translation/js.lux index d38409b10..9fd2d098f 100644 --- a/new-luxc/source/luxc/lang/translation/js.lux +++ b/new-luxc/source/luxc/lang/translation/js.lux @@ -93,26 +93,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "$" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -124,7 +124,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -132,15 +132,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -150,7 +150,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -160,7 +160,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -170,14 +170,14 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) - (:! Host) + (:coerce Host) (get@ #interpreter) (ScriptEngine::eval [code])) (#e.Error error) @@ -193,7 +193,7 @@ (AbstractJSObject (isFunction) boolean true) (AbstractJSObject (call [args (Array Object)]) Object - (Object::toString [] (:! Object js-object))) + (Object::toString [] (:coerce Object js-object))) )) (def: (::slice js-object value) @@ -203,10 +203,10 @@ (AbstractJSObject (isFunction) boolean true) (AbstractJSObject (call [args (Array Object)]) Object - (:! Object - (js-object (Arrays::copyOfRange [value - (|> args (array.read +0) maybe.assume (:! Int)) - (.int (array.size value))])))) + (:coerce Object + (js-object (Arrays::copyOfRange [value + (|> args (array.read +0) maybe.assume (:coerce Int)) + (.int (array.size value))])))) )) (def: #export int-high-field Text "H") @@ -218,7 +218,7 @@ (def: jvm-int (-> Nat Integer) - (|>> (:! Long) (Long::intValue []))) + (|>> (:coerce Long) (Long::intValue []))) (def: low-mask Nat @@ -238,7 +238,7 @@ [] ## Methods (IntValue (getValue) Long - (:! Long value)) + (:coerce Long value)) (AbstractJSObject (getMember [member String]) Object (cond (text/= int-high-field member) (|> value .nat high jvm-int) @@ -262,13 +262,13 @@ [] ## Methods (StructureValue (getValue) (Array Object) - (:! (Array Object) value)) + (:coerce (Array Object) value)) (AbstractJSObject (isArray) boolean true) (AbstractJSObject (getMember [member String]) Object (cond (text/= "toString" member) - (:! Object - (::toString value)) + (:coerce Object + (::toString value)) (text/= "length" member) (jvm-int (array.size value)) @@ -276,32 +276,32 @@ (text/= "slice" member) (let [js-object (: (-> Object JSObject) (|>> (cond> [(host.instance? (Array Object))] - [(:! (Array Object)) js-structure] + [(:coerce (Array Object)) js-structure] [(host.instance? Long)] - [(:! Int) js-int] + [(:coerce Int) js-int] ## else - [(:! JSObject)])))] - (:! Object - (::slice js-object value))) + [(:coerce JSObject)])))] + (:coerce Object + (::slice js-object value))) ## else - (error! (ex.construct Unknown-Member (format " member = " (:! Text member) "\n" - "object(structure) = " (Object::toString [] (:! Object value)) "\n"))))) + (error! (ex.construct Unknown-Member (format " member = " (:coerce Text member) "\n" + "object(structure) = " (Object::toString [] (:coerce Object value)) "\n"))))) (AbstractJSObject (getSlot [idx int]) Object (|> value - (array.read (|> idx (Integer::longValue []) (:! Nat))) + (array.read (|> idx (Integer::longValue []) (:coerce Nat))) maybe.assume (cond> [(host.instance? (Array Object))] - [(:! (Array Object)) js-structure] + [(:coerce (Array Object)) js-structure] [(host.instance? Long)] - [(:! Int) js-int] + [(:coerce Int) js-int] ## else - [(:! JSObject)]) - (:! Object))) + [(:coerce JSObject)]) + (:coerce Object))) )) (def: #export unit Text "") @@ -320,7 +320,7 @@ (-> JS (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -335,7 +335,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (module-name module) "/" module-js-name) diff --git a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux index 94136f356..8019ded53 100644 --- a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux @@ -61,13 +61,13 @@ (^multi [(#.Some high) (#.Some low)] (and (host.instance? Number high) (host.instance? Number low)) - [[(Number::longValue [] (:! Number high)) - (Number::longValue [] (:! Number low))] + [[(Number::longValue [] (:coerce Number high)) + (Number::longValue [] (:coerce Number low))] [high low]]) - (#.Some (.int (n/+ (|> high (:! Nat) (bit.left-shift +32)) - (if (i/< 0 (:! Int low)) - (|> low (:! Nat) (bit.left-shift +32) (bit.logical-right-shift +32)) - (|> low (:! Nat)))))) + (#.Some (.int (n/+ (|> high (:coerce Nat) (bit.left-shift +32)) + (if (i/< 0 (:coerce Int low)) + (|> low (:coerce Nat) (bit.left-shift +32) (bit.logical-right-shift +32)) + (|> low (:coerce Nat)))))) _ #.None)) @@ -79,7 +79,7 @@ (JSObject::getMember [//.variant-value-field] js-object)] (^multi [(#.Some tag) ?flag (#.Some value)] (host.instance? Number tag) - [[(Number::intValue [] (:! Number tag)) + [[(Number::intValue [] (:coerce Number tag)) (lux-object value)] [tag (#.Some value)]]) (#.Some [tag (maybe.default (host.null) ?flag) value]) @@ -101,7 +101,7 @@ (#.Some member) (case (lux-object member) (#e.Success parsed-member) - (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output)) + (recur num-keys (inc idx) (array.write idx (:coerce Object parsed-member) output)) (#e.Error error) #.None) @@ -117,24 +117,24 @@ (ex.throw Null-Has-No-Lux-Representation "") (host.instance? Integer js-object) - (ex.return (Integer::longValue [] (:! Integer js-object))) + (ex.return (Integer::longValue [] (:coerce Integer js-object))) (or (host.instance? java/lang/Boolean js-object) (host.instance? java/lang/String js-object)) (ex.return js-object) (host.instance? Number js-object) - (ex.return (Number::doubleValue [] (:! Number js-object))) + (ex.return (Number::doubleValue [] (:coerce Number js-object))) (~~ (do-template [<interface> <method>] [(host.instance? <interface> js-object) - (ex.return (<method> [] (:! <interface> js-object)))] + (ex.return (<method> [] (:coerce <interface> js-object)))] [StructureValue StructureValue::getValue] [IntValue IntValue::getValue])) (host.instance? ScriptObjectMirror js-object) - (let [js-object (:! ScriptObjectMirror js-object)] + (let [js-object (:coerce ScriptObjectMirror js-object)] (case (int js-object) (#.Some value) (ex.return value) @@ -154,17 +154,17 @@ ## js-object ## else - (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:! Object js-object))))))) + (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:coerce Object js-object))))))) ## else - (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:! Object js-object)))))) + (ex.throw Unknown-Kind-Of-JS-Object (Object::toString [] (:coerce Object js-object)))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) (case (|> compiler (get@ #.host) - (:! //.Host) + (:coerce //.Host) (get@ #//.interpreter) (ScriptEngine::eval [code])) (#e.Error error) diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux index 305f46adf..5fedc9a9e 100644 --- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux @@ -31,7 +31,7 @@ (def: deg-to-nat (-> Deg Nat) - (|>> (:! Nat))) + (|>> (:coerce Nat))) (def: #export translate-deg (-> Deg (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux index 849ae76c2..317193691 100644 --- a/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/statement.jvm.lux @@ -33,7 +33,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index 28560854d..f5d288827 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -86,9 +86,9 @@ ($i.long (|> value <prep>)) $i.LCMP ($i.IFNE @else)))) - ([#.Nat (:! Int)] + ([#.Nat (:coerce Int)] [#.Int (: Int)] - [#.Deg (:! Int)]) + [#.Deg (:coerce Int)]) [_ (#.Frac value)] (macro/wrap (|>> peekI diff --git a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux index b678677ce..2f35bad7c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/common.jvm.lux @@ -65,17 +65,17 @@ (All [a] (-> (Meta a) (Meta [Artifacts a]))) (function (_ compiler) (case (action (update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #artifacts (dict.new text.Hash<Text>)) - (:! Nothing)) + (:coerce Nothing)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) - (set@ #artifacts (|> (get@ #.host compiler) (:! Host) (get@ #artifacts))) - (:! Nothing)) + (|>> (:coerce Host) + (set@ #artifacts (|> (get@ #.host compiler) (:coerce Host) (get@ #artifacts))) + (:coerce Nothing)) compiler') - [(|> compiler' (get@ #.host) (:! Host) (get@ #artifacts)) + [(|> compiler' (get@ #.host) (:coerce Host) (get@ #artifacts)) output]]) (#e.Error error) @@ -84,12 +84,12 @@ (def: #export (record-artifact name content) (-> Text Blob (Meta Any)) (function (_ compiler) - (if (|> compiler (get@ #.host) (:! Host) (get@ #artifacts) (dict.contains? name)) + (if (|> compiler (get@ #.host) (:coerce Host) (get@ #artifacts) (dict.contains? name)) (ex.throw Cannot-Overwrite-Artifact name) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (update@ #artifacts (dict.put name content)) - (:! Nothing)) + (:coerce Nothing)) compiler) []])))) @@ -97,7 +97,7 @@ (-> Text Bytecode (Meta Any)) (function (_ compiler) (let [store (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #store))] (if (dict.contains? name (|> store atom.read io.run)) (ex.throw Class-Already-Stored name) @@ -107,7 +107,7 @@ (def: #export (load-class name) (-> Text (Meta (Class Object))) (function (_ compiler) - (let [host (:! Host (get@ #.host compiler)) + (let [host (:coerce Host (get@ #.host compiler)) store (|> host (get@ #store) atom.read io.run)] (if (dict.contains? name store) (#e.Success [compiler (ClassLoader::loadClass [name] (get@ #loader host))]) diff --git a/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux index 4c52231f3..07c85e58c 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/statement.jvm.lux @@ -87,7 +87,7 @@ (wrap []) tags - (&module.declare-tags tags (macro.export? metaV) (:! Type valueV))) + (&module.declare-tags tags (macro.export? metaV) (:coerce Type valueV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (commonT.record-artifact (format bytecode-name ".class") bytecode))))) diff --git a/new-luxc/source/luxc/lang/translation/lua.lux b/new-luxc/source/luxc/lang/translation/lua.lux index d09746351..307b6a181 100644 --- a/new-luxc/source/luxc/lang/translation/lua.lux +++ b/new-luxc/source/luxc/lang/translation/lua.lux @@ -96,7 +96,7 @@ (function (_ code) (let [lua-function (ChunkLoader::loadTextChunk [variable "lux compilation" code] loader)] - ("lux try" (io (DirectCallExecutor::call [state-context (:! Object lua-function) (array.new +0)] + ("lux try" (io (DirectCallExecutor::call [state-context (:coerce Object lua-function) (array.new +0)] executor)))))) #module-buffer #.None #program-buffer (StringBuilder::new [])})) @@ -107,26 +107,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -138,7 +138,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -146,15 +146,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -164,7 +164,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -174,7 +174,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -184,12 +184,12 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce Host) (get@ #interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -211,7 +211,7 @@ (-> Lua (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -222,7 +222,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" lua-module-name) diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux index ed084b44d..a72bf0011 100644 --- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (lua.int (:! Int idx))))) + (method source (lua.int (:coerce Int idx))))) valueO path)))) @@ -102,22 +102,22 @@ [_ (<tag> value)] (meta/wrap (lua.when! (lua.not (lua.= (|> value <format>) cursor-top)) (lua.return! pm-error)))) - ([#.Nat (<| lua.int (:! Int))] + ([#.Nat (<| lua.int (:coerce Int))] [#.Int lua.int] - [#.Deg (<| lua.int (:! Int))] + [#.Deg (<| lua.int (:coerce Int))] [#.Bool lua.bool] [#.Frac lua.float] [#.Text lua.string]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (lua.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (lua.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:! Int idx)) <flag>)) + (meta/wrap (lua.block! (list (lua.set! "temp" (runtimeT.sum//get cursor-top (lua.int (:coerce Int idx)) <flag>)) (lua.if! (lua.= lua.nil "temp") (lua.return! pm-error) (push-cursor! "temp")))))) diff --git a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux index 0e413e7ad..0330f79c2 100644 --- a/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/eval.jvm.lux @@ -45,7 +45,7 @@ (^multi [(#.Some tag) ?flag (#.Some value)] [(lux-object value) (#.Some value)]) - (#.Some [(Long::intValue [] (:! Long tag)) + (#.Some [(Long::intValue [] (:coerce Long tag)) (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) @@ -54,17 +54,17 @@ (def: (array lux-object host-object) (-> (-> Object (Error Any)) DefaultTable (Maybe (Array Object))) - (let [init-num-keys (:! Nat (Table::rawlen [] host-object))] + (let [init-num-keys (:coerce Nat (Table::rawlen [] host-object))] (loop [num-keys init-num-keys idx +0 output (: (Array Object) (array.new init-num-keys))] (if (n/< num-keys idx) - (case (Table::get-idx (:! Long (inc idx)) host-object) + (case (Table::get-idx (:coerce Long (inc idx)) host-object) (#.Some member) (case (lux-object member) (#e.Success parsed-member) - (recur num-keys (inc idx) (array.write idx (:! Object parsed-member) output)) + (recur num-keys (inc idx) (array.write idx (:coerce Object parsed-member) output)) (#e.Error error) #.None) @@ -85,10 +85,10 @@ (ex.return host-object) (host.instance? ByteString host-object) - (ex.return (ByteString::decode [] (:! ByteString host-object))) + (ex.return (ByteString::decode [] (:coerce ByteString host-object))) (host.instance? DefaultTable host-object) - (let [host-object (:! DefaultTable host-object)] + (let [host-object (:coerce DefaultTable host-object)] (case (variant lux-object host-object) (#.Some value) (ex.return value) @@ -99,23 +99,23 @@ (ex.return value) #.None - (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:! Object host-object))))))) + (ex.throw Unknown-Kind-Of-Host-Object (format "SECOND " (Object::toString [] (:coerce Object host-object))))))) ## else - (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:! Object host-object)))) + (ex.throw Unknown-Kind-Of-Host-Object (format "FIRST " (Object::toString [] (:coerce Object host-object)))) )) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter (format "return " code ";")) (#e.Error error) ((lang.throw Cannot-Evaluate error) compiler) (#e.Success output) (case (lux-object (|> output - (:! (Array Object)) + (:coerce (Array Object)) (array.read +0) maybe.assume)) (#e.Success parsed-output) diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux index c322e5005..5769f6890 100644 --- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -16,11 +16,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux index 3a438ae65..8ff9c1ccd 100644 --- a/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/php.lux b/new-luxc/source/luxc/lang/translation/php.lux index 8ee0f9c14..fe4e6095c 100644 --- a/new-luxc/source/luxc/lang/translation/php.lux +++ b/new-luxc/source/luxc/lang/translation/php.lux @@ -80,26 +80,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -111,7 +111,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -119,15 +119,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -137,7 +137,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -147,7 +147,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -157,13 +157,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [<name> <field> <inputT> <outputT>] [(def: (<name> code) (-> <inputT> (Meta <outputT>)) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -189,7 +189,7 @@ (-> Statement (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (_.code code))] + #let [_ (Appendable::append [(:coerce CharSequence (_.code code))] module-buffer)]] (load! code))) @@ -200,7 +200,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" ..module-name) diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux index 3a5eff053..6f78637cf 100644 --- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux @@ -39,7 +39,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (_.int (:! Int idx))))) + (method source (_.int (:coerce Int idx))))) valueO pathP)))) @@ -114,22 +114,22 @@ [_ (<tag> value)] (meta/wrap (_.when! (_.not (_.= (|> value <format>) cursor-top)) fail-pm!))) - ([#.Nat (<| _.int (:! Int))] + ([#.Nat (<| _.int (:coerce Int))] [#.Int _.int] - [#.Deg (<| _.int (:! Int))] + [#.Deg (<| _.int (:coerce Int))] [#.Bool _.bool] [#.Frac _.float] [#.Text _.string]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (_.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (_.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:! Int idx)) <flag>)) + (meta/wrap (|> (_.set! @temp (runtimeT.sum//get cursor-top (_.int (:coerce Int idx)) <flag>)) (_.then! (_.if! (_.is-null/1 @temp) fail-pm! (push-cursor! @temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux index 54ec6abc2..4b954c4f1 100644 --- a/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/eval.jvm.lux @@ -29,8 +29,8 @@ (intValue [] Integer)) (exception: #export (Unknown-Kind-Of-Host-Object {host-object Object}) - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (format object-class " --- " text-representation))) (host.import php/runtime/Memory) @@ -63,18 +63,18 @@ (-> (-> Object (Error Any)) ArrayMemory (Error Any)) (let [size (ArrayMemory::size [] host-object)] (loop [idx 0 - output (: (Array Any) (array.new (:! Nat size)))] + output (: (Array Any) (array.new (:coerce Nat size)))] (if (i/< size idx) (let [value (|> host-object (ArrayMemory::get [(LongMemory::new [idx])]) - (:! ReferenceMemory) (ReferenceMemory::getValue []))] + (:coerce ReferenceMemory) (ReferenceMemory::getValue []))] (if (host.instance? php/runtime/memory/NullMemory value) (recur (inc idx) - (array.write (:! Nat idx) (host.null) output)) + (array.write (:coerce Nat idx) (host.null) output)) (do e.Monad<Error> [lux-value (lux-object value)] (recur (inc idx) - (array.write (:! Nat idx) lux-value output))))) + (array.write (:coerce Nat idx) lux-value output))))) (ex.return output))))) (def: (variant lux-object host-object) @@ -83,11 +83,11 @@ [variant-tag (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-tag-field])] host-object)) variant-value (lux-object (ArrayMemory::get [(StringMemory::new [//.variant-value-field])] host-object))] (wrap (: Any - [(Long::intValue [] (:! Long variant-tag)) + [(Long::intValue [] (:coerce Long variant-tag)) (: Any (if (|> host-object (ArrayMemory::get [(StringMemory::new [//.variant-flag-field])]) - (:! ReferenceMemory) + (:coerce ReferenceMemory) (ReferenceMemory::getValue []) (host.instance? php/runtime/memory/NullMemory)) (host.null) @@ -103,21 +103,21 @@ (ex.return true) (host.instance? php/runtime/memory/LongMemory host-object) - (ex.return (LongMemory::toLong [] (:! LongMemory host-object))) + (ex.return (LongMemory::toLong [] (:coerce LongMemory host-object))) (host.instance? php/runtime/memory/DoubleMemory host-object) - (ex.return (DoubleMemory::toDouble [] (:! DoubleMemory host-object))) + (ex.return (DoubleMemory::toDouble [] (:coerce DoubleMemory host-object))) (host.instance? php/runtime/memory/StringMemory host-object) - (ex.return (StringMemory::toString [] (:! StringMemory host-object))) + (ex.return (StringMemory::toString [] (:coerce StringMemory host-object))) (host.instance? php/runtime/memory/ReferenceMemory host-object) - (lux-object (ReferenceMemory::getValue [] (:! ReferenceMemory host-object))) + (lux-object (ReferenceMemory::getValue [] (:coerce ReferenceMemory host-object))) (host.instance? php/runtime/memory/ArrayMemory host-object) - (if (ArrayMemory::isMap [] (:! ArrayMemory host-object)) - (variant lux-object (:! ArrayMemory host-object)) - (tuple lux-object (:! ArrayMemory host-object))) + (if (ArrayMemory::isMap [] (:coerce ArrayMemory host-object)) + (variant lux-object (:coerce ArrayMemory host-object)) + (tuple lux-object (:coerce ArrayMemory host-object))) ## else (ex.throw Unknown-Kind-Of-Host-Object host-object))) @@ -125,7 +125,7 @@ (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Evaluate error) compiler) diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index 43497c93e..cd67be0f0 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -37,9 +37,9 @@ [_ (<tag> value)] (|> value <generator>)) ([#.Bool primitiveT.translate-bool] - [#.Nat (<| primitiveT.translate-int (:! Int))] + [#.Nat (<| primitiveT.translate-int (:coerce Int))] [#.Int primitiveT.translate-int] - [#.Deg (<| primitiveT.translate-int (:! Int))] + [#.Deg (<| primitiveT.translate-int (:coerce Int))] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux index 9146684e4..4364d87ea 100644 --- a/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/reference.jvm.lux @@ -12,7 +12,7 @@ (do-template [<register> <prefix>] [(def: #export <register> (-> Register Var) - (|>> (:! Int) %i (format <prefix>) _.var))] + (|>> (:coerce Int) %i (format <prefix>) _.var))] [closure "c"] [variable "v"]) @@ -21,7 +21,7 @@ (-> Variable Var) (if (variableL.captured? var) (closure (variableL.captured-register var)) - (variable (:! Nat var)))) + (variable (:coerce Nat var)))) (def: #export global (-> Ident Var) diff --git a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux index a20e164ca..70a39a575 100644 --- a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/python.lux b/new-luxc/source/luxc/lang/translation/python.lux index 3dde69d2a..8dac22fca 100644 --- a/new-luxc/source/luxc/lang/translation/python.lux +++ b/new-luxc/source/luxc/lang/translation/python.lux @@ -77,26 +77,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -108,7 +108,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -116,15 +116,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -134,7 +134,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -144,7 +144,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -154,13 +154,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [<name> <field> <inputT> <outputT>] [(def: (<name> code) (-> <inputT> (Meta <outputT>)) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -187,7 +187,7 @@ (-> <inputT> (Meta <outputT>)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (<un-wrap> code))] + #let [_ (Appendable::append [(:coerce CharSequence (<un-wrap> code))] module-buffer)]] (<eval> code)))] @@ -202,7 +202,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" python-module-name) diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux index f51acc402..aedf2a6e1 100644 --- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (python.int (:! Int idx))))) + (method source (python.int (:coerce Int idx))))) valueO pathP)))) @@ -115,23 +115,23 @@ [_ (<tag> value)] (meta/wrap (python.when! (python.not (python.= (|> value <format>) cursor-top)) fail-pm!))) - ([#.Nat (<| python.int (:! Int))] + ([#.Nat (<| python.int (:coerce Int))] [#.Int python.int] - [#.Deg (<| python.int (:! Int))] + [#.Deg (<| python.int (:coerce Int))] [#.Bool python.bool] [#.Frac python.float] [#.Text python.string]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (python.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (python.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) (meta/wrap ($_ python.then! - (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:! Int idx)) <flag>)) + (python.set! (list $temp) (runtimeT.sum//get cursor-top (python.int (:coerce Int idx)) <flag>)) (python.if! (python.= python.none (@@ $temp)) fail-pm! (push-cursor! (@@ $temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux index df1e7004c..88fdd3173 100644 --- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux @@ -46,11 +46,11 @@ (def: (tuple lux-object host-object) (-> (-> PyObject (Error Any)) PyObject (Error Any)) - (let [size (:! Nat (PyObject::__len__ [] host-object))] + (let [size (:coerce Nat (PyObject::__len__ [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (PyObject::__getitem__ [(:! Int idx)] host-object) + (case (PyObject::__getitem__ [(:coerce Int idx)] host-object) (#e.Error error) (#e.Error error) @@ -65,7 +65,7 @@ (def: python-type (-> PyObject Text) - (|>> (PyObject::getType []) (PyType::getName []) (:! Text))) + (|>> (PyObject::getType []) (PyType::getName []) (:coerce Text))) (def: tag-field (PyString::new [//.variant-tag-field])) (def: flag-field (PyString::new [//.variant-flag-field])) @@ -84,9 +84,9 @@ (#e.Success tag)] [(lux-object value) (#e.Success value)]) - (#e.Success [(Long::intValue [] (:! Long tag)) + (#e.Success [(Long::intValue [] (:coerce Long tag)) (: Any - (case (python-type (:! PyObject flag)) + (case (python-type (:coerce PyObject flag)) "NoneType" (host.null) @@ -127,7 +127,7 @@ (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux index 7b2ba1786..f1cf731a2 100644 --- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux @@ -13,11 +13,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) python.int meta/wrap)) + (|>> (:coerce Int) python.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) python.int meta/wrap)) + (|>> (:coerce Int) python.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux index 23b51371c..c241afa8a 100644 --- a/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/r.lux b/new-luxc/source/luxc/lang/translation/r.lux index 4864cc286..e9c984636 100644 --- a/new-luxc/source/luxc/lang/translation/r.lux +++ b/new-luxc/source/luxc/lang/translation/r.lux @@ -74,7 +74,7 @@ #interpreter (function (_ code) (do e.Monad<Error> [output (ScriptEngine::eval [(r.expression code)] interpreter)] - (wrap (maybe.default (:! Object []) + (wrap (maybe.default (:coerce Object []) output)))) #module-buffer #.None #program-buffer (StringBuilder::new [])}))) @@ -85,26 +85,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -116,7 +116,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -124,15 +124,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -142,7 +142,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -152,7 +152,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -162,13 +162,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -197,7 +197,7 @@ (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (r.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (r.expression code))] module-buffer)]] (load! code))) @@ -210,7 +210,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux index 21d8f1def..3aa3d4a8a 100644 --- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux @@ -39,7 +39,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (r.int (:! Int idx))))) + (method source (r.int (:coerce Int idx))))) valueO pathP)))) @@ -124,20 +124,20 @@ [_ (<tag> value)] (meta/wrap (r.when (r.not (runtimeT.int//= (|> value <format>) cursor-top)) fail-pm!))) - ([#.Nat (<| runtimeT.int (:! Int))] + ([#.Nat (<| runtimeT.int (:coerce Int))] [#.Int runtimeT.int] - [#.Deg (<| runtimeT.int (:! Int))]) + [#.Deg (<| runtimeT.int (:coerce Int))]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (r.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (r.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) (meta/wrap ($_ r.then - (r.set! $temp (runtimeT.sum//get cursor-top (r.int (:! Int idx)) <flag>)) + (r.set! $temp (runtimeT.sum//get cursor-top (r.int (:coerce Int idx)) <flag>)) (r.if (r.= r.null (@@ $temp)) fail-pm! (push-cursor! (@@ $temp)))))) diff --git a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux index e3a255e41..eb20d73c5 100644 --- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux @@ -51,21 +51,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) ListVector (Error Any)) - (let [size (:! Nat (ListVector::length [] host-object))] + (let [size (:coerce Nat (ListVector::length [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (ListVector::getElementAsSEXP [(:! Int idx)] host-object) + (case (ListVector::getElementAsSEXP [(:coerce Int idx)] host-object) (#e.Error error) (#e.Error error) (#e.Success value) - (case (lux-object (:! Object value)) + (case (lux-object (:coerce Object value)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output)))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output)))) (#e.Success output))))) (def: (parse-variant lux-object host-object) @@ -74,9 +74,9 @@ [tag (ListVector::get-field-sexp [//.variant-tag-field] host-object) flag (ListVector::get-field-sexp [//.variant-flag-field] host-object) value (ListVector::get-field-sexp [//.variant-value-field] host-object) - value (lux-object (:! Object value))] + value (lux-object (:coerce Object value))] (wrap [(|> tag - (:! IntArrayVector) + (:coerce IntArrayVector) (IntArrayVector::getElementAsInt [0]) (Long::intValue [])) (: Any @@ -90,35 +90,35 @@ (do e.Monad<Error> [high (ListVector::get-field-sexp [//.int-high-field] host-object) low (ListVector::get-field-sexp [//.int-low-field] host-object) - #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:! Nat)) - high (get-int-32 (:! IntArrayVector high)) - low (get-int-32 (:! IntArrayVector low))]] - (wrap (:! Int + #let [get-int-32 (|>> (IntArrayVector::getElementAsInt [0]) (:coerce Nat)) + high (get-int-32 (:coerce IntArrayVector high)) + low (get-int-32 (:coerce IntArrayVector low))]] + (wrap (:coerce Int (n/+ (|> high (bit.left-shift +32)) - (if (i/< 0 (:! Int low)) + (if (i/< 0 (:coerce Int low)) (|> low (bit.left-shift +32) (bit.logical-right-shift +32)) low)))))) (def: (lux-object host-object) (-> Object (Error Any)) (cond (host.instance? StringArrayVector host-object) - (#e.Success (StringArrayVector::getElementAsString [0] (:! StringArrayVector host-object))) + (#e.Success (StringArrayVector::getElementAsString [0] (:coerce StringArrayVector host-object))) (host.instance? LogicalArrayVector host-object) - (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:! LogicalArrayVector host-object)))) + (#e.Success (i/= 1 (LogicalArrayVector::getElementAsRawLogical [0] (:coerce LogicalArrayVector host-object)))) (host.instance? IntArrayVector host-object) - (#e.Success (IntArrayVector::getElementAsInt [0] (:! IntArrayVector host-object))) + (#e.Success (IntArrayVector::getElementAsInt [0] (:coerce IntArrayVector host-object))) (host.instance? DoubleArrayVector host-object) - (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:! DoubleArrayVector host-object))) + (#e.Success (DoubleArrayVector::getElementAsDouble [0] (:coerce DoubleArrayVector host-object))) (host.instance? ListVector host-object) - (case (parse-int (:! ListVector host-object)) + (case (parse-int (:coerce ListVector host-object)) (#e.Error error) - (case (parse-variant lux-object (:! ListVector host-object)) + (case (parse-variant lux-object (:coerce ListVector host-object)) (#e.Error error) - (parse-tuple lux-object (:! ListVector host-object)) + (parse-tuple lux-object (:coerce ListVector host-object)) output output) @@ -127,14 +127,14 @@ output) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux index a6101f749..ad89f2e31 100644 --- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux @@ -15,11 +15,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) runtimeT.int meta/wrap)) + (|>> (:coerce Int) runtimeT.int meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) runtimeT.int meta/wrap)) + (|>> (:coerce Int) runtimeT.int meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux index 62349abcf..e09410f40 100644 --- a/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/ruby.lux b/new-luxc/source/luxc/lang/translation/ruby.lux index 808d8105c..1ed9f30e1 100644 --- a/new-luxc/source/luxc/lang/translation/ruby.lux +++ b/new-luxc/source/luxc/lang/translation/ruby.lux @@ -71,26 +71,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -102,7 +102,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -110,15 +110,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -128,7 +128,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -138,7 +138,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -148,12 +148,12 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (def: (execute code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! Host) (get@ #interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce Host) (get@ #interpreter))] (case (interpreter code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -175,7 +175,7 @@ (-> Ruby (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence code)] + #let [_ (Appendable::append [(:coerce CharSequence code)] module-buffer)]] (execute code))) @@ -186,7 +186,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" ruby-module-name) diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux index d76b2a757..b7b1f131d 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux @@ -38,7 +38,7 @@ (let [method (if tail? runtimeT.product//right runtimeT.product//left)] - (method source (ruby.int (:! Int idx))))) + (method source (ruby.int (:coerce Int idx))))) valueO path)))) @@ -107,22 +107,22 @@ [_ (<tag> value)] (meta/wrap (ruby.when! (ruby.not (ruby.= (|> value <format>) cursor-top)) (ruby.raise pm-error)))) - ([#.Nat (<| ruby.int (:! Int))] + ([#.Nat (<| ruby.int (:coerce Int))] [#.Int ruby.int] - [#.Deg (<| ruby.int (:! Int))] + [#.Deg (<| ruby.int (:coerce Int))] [#.Bool ruby.bool] [#.Frac ruby.float] [#.Text ruby.string]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (push-cursor! (<getter> cursor-top (ruby.int (:! Int idx)))))) + (meta/wrap (push-cursor! (<getter> cursor-top (ruby.int (:coerce Int idx)))))) (["lux case tuple left" runtimeT.product//left] ["lux case tuple right" runtimeT.product//right]) (^template [<pm> <flag>] (^code (<pm> (~ [_ (#.Nat idx)]))) - (meta/wrap (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:! Int idx)) <flag>)) + (meta/wrap (ruby.block! (list (ruby.set! (list "temp") (runtimeT.sum//get cursor-top (ruby.int (:coerce Int idx)) <flag>)) (ruby.if! (ruby.= ruby.nil "temp") (ruby.raise pm-error) (push-cursor! "temp")))))) diff --git a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux index 7d43e5460..3c590e8ee 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/eval.jvm.lux @@ -37,11 +37,11 @@ (def: (tuple lux-object host-object) (-> (-> Object (Error Any)) RubyArray (Error Any)) - (let [size (:! Nat (RubyArray::getLength [] host-object))] + (let [size (:coerce Nat (RubyArray::getLength [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (RubyArray::get [(:! Int idx)] host-object) + (case (RubyArray::get [(:coerce Int idx)] host-object) #.None (recur (inc idx) output) @@ -56,13 +56,13 @@ (def: (variant lux-object host-object) (-> (-> Object (Error Any)) RubyHash (Error Any)) - (case [(RubyHash::get [(:! Object //.variant-tag-field)] host-object) - (RubyHash::get [(:! Object //.variant-flag-field)] host-object) - (RubyHash::get [(:! Object //.variant-value-field)] host-object)] + (case [(RubyHash::get [(:coerce Object //.variant-tag-field)] host-object) + (RubyHash::get [(:coerce Object //.variant-flag-field)] host-object) + (RubyHash::get [(:coerce Object //.variant-value-field)] host-object)] (^multi [(#.Some tag) ?flag (#.Some value)] [(lux-object value) (#.Some value)]) - (#e.Success [(Long::intValue [] (:! Long tag)) + (#e.Success [(Long::intValue [] (:coerce Long tag)) (: Any (case ?flag (#.Some _) "" #.None (host.null))) value]) @@ -81,28 +81,28 @@ (ex.return host-object) (host.instance? org/jruby/RubyArray host-object) - (tuple lux-object (:! RubyArray host-object)) + (tuple lux-object (:coerce RubyArray host-object)) (host.instance? org/jruby/RubyHash host-object) - (case (variant lux-object (:! RubyHash host-object)) + (case (variant lux-object (:coerce RubyHash host-object)) (#e.Success value) (#e.Success value) _ - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation)))) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))) ))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" @@ -111,7 +111,7 @@ ((lang.throw Cannot-Evaluate error) compiler)) (#e.Success output) - (case (lux-object (:! Object output)) + (case (lux-object (:coerce Object output)) (#e.Success parsed-output) (exec ## (log! (format "eval #e.Success\n" ## "<< " code)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux index 1e76ef9e4..1f05cf2fd 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux @@ -16,11 +16,11 @@ (def: #export translate-nat (-> Nat (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-deg (-> Deg (Meta Expression)) - (|>> (:! Int) %i meta/wrap)) + (|>> (:coerce Int) %i meta/wrap)) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux index 135a09039..83792921d 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) diff --git a/new-luxc/source/luxc/lang/translation/scheme.lux b/new-luxc/source/luxc/lang/translation/scheme.lux index a117899fa..af3208414 100644 --- a/new-luxc/source/luxc/lang/translation/scheme.lux +++ b/new-luxc/source/luxc/lang/translation/scheme.lux @@ -72,7 +72,7 @@ #interpreter (function (_ code) (do e.Monad<Error> [output (Language::eval [(scheme.expression code)] interpreter)] - (wrap (maybe.default (:! Object []) + (wrap (maybe.default (:coerce Object []) output)))) #module-buffer #.None #program-buffer (StringBuilder::new [])}))) @@ -85,26 +85,26 @@ (Meta Any) (function (_ compiler) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #module-buffer (#.Some (StringBuilder::new []))) - (:! Nothing)) + (:coerce Nothing)) compiler) []]))) (def: #export (with-sub-context expr) (All [a] (-> (Meta a) (Meta [Text a]))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler)) + (let [old (:coerce Host (get@ #.host compiler)) [old-name old-sub] (get@ #context old) new-name (format old-name "f___" (%i (.int old-sub)))] (case (expr (set@ #.host - (:! Nothing (set@ #context [new-name +0] old)) + (:coerce Nothing (set@ #context [new-name +0] old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #context [old-name (inc old-sub)]) - (:! Nothing)) + (:coerce Nothing)) compiler') [new-name output]]) @@ -116,7 +116,7 @@ (function (_ compiler) (#e.Success [compiler (|> (get@ #.host compiler) - (:! Host) + (:coerce Host) (get@ #context) (let> [name sub] name))]))) @@ -124,15 +124,15 @@ (def: #export (with-anchor anchor expr) (All [a] (-> Anchor (Meta a) (Meta a))) (function (_ compiler) - (let [old (:! Host (get@ #.host compiler))] + (let [old (:coerce Host (get@ #.host compiler))] (case (expr (set@ #.host - (:! Nothing (set@ #anchor (#.Some anchor) old)) + (:coerce Nothing (set@ #anchor (#.Some anchor) old)) compiler)) (#e.Success [compiler' output]) (#e.Success [(update@ #.host - (|>> (:! Host) + (|>> (:coerce Host) (set@ #anchor (get@ #anchor old)) - (:! Nothing)) + (:coerce Nothing)) compiler') output]) @@ -142,7 +142,7 @@ (def: #export anchor (Meta Anchor) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #anchor)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #anchor)) (#.Some anchor) (#e.Success [compiler anchor]) @@ -152,7 +152,7 @@ (def: #export module-buffer (Meta StringBuilder) (function (_ compiler) - (case (|> compiler (get@ #.host) (:! Host) (get@ #module-buffer)) + (case (|> compiler (get@ #.host) (:coerce Host) (get@ #module-buffer)) #.None ((lang.throw No-Active-Module-Buffer "") compiler) @@ -162,13 +162,13 @@ (def: #export program-buffer (Meta StringBuilder) (function (_ compiler) - (#e.Success [compiler (|> compiler (get@ #.host) (:! Host) (get@ #program-buffer))]))) + (#e.Success [compiler (|> compiler (get@ #.host) (:coerce Host) (get@ #program-buffer))]))) (do-template [<name> <field> <outputT>] [(def: (<name> code) (-> Expression (Meta <outputT>)) (function (_ compiler) - (let [runner (|> compiler (get@ #.host) (:! Host) (get@ <field>))] + (let [runner (|> compiler (get@ #.host) (:coerce Host) (get@ <field>))] (case (runner code) (#e.Error error) ((lang.throw Cannot-Execute error) compiler) @@ -192,7 +192,7 @@ (-> Expression (Meta Any)) (do macro.Monad<Meta> [module-buffer module-buffer - #let [_ (Appendable::append [(:! CharSequence (scheme.expression code))] + #let [_ (Appendable::append [(:coerce CharSequence (scheme.expression code))] module-buffer)]] (load! code))) @@ -205,7 +205,7 @@ module-buffer module-buffer program-buffer program-buffer #let [module-code (StringBuilder::toString [] module-buffer) - _ (Appendable::append [(:! CharSequence (format module-code "\n"))] + _ (Appendable::append [(:coerce CharSequence (format module-code "\n"))] program-buffer)]] (wrap (ioC.write target (format (lang.normalize-name module) "/" r-module-name) diff --git a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux index 362deee4a..72c58587c 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/eval.jvm.lux @@ -60,21 +60,21 @@ (def: (parse-tuple lux-object host-object) (-> (-> Object (Error Any)) (FVector Object) (Error Any)) - (let [size (:! Nat (FVector::getBufferLength [] host-object))] + (let [size (:coerce Nat (FVector::getBufferLength [] host-object))] (loop [idx +0 - output (:! (Array Any) (array.new size))] + output (:coerce (Array Any) (array.new size))] (if (n/< size idx) - (case (lux-object (FVector::get [(:! Int idx)] host-object)) + (case (lux-object (FVector::get [(:coerce Int idx)] host-object)) (#e.Error error) (#e.Error error) (#e.Success lux-value) - (recur (inc idx) (array.write idx (:! Any lux-value) output))) + (recur (inc idx) (array.write idx (:coerce Any lux-value) output))) (#e.Success output))))) (def: (variant tag flag value) (-> Nat Bool Any Any) - [(Long::intValue [] (:! Long tag)) + [(Long::intValue [] (:coerce Long tag)) (: Any (if flag //.unit @@ -83,24 +83,24 @@ (def: (to-text value) (-> Any Text) - (let [value-text (:! Text (Object::toString [] (:! Object value))) - class-text (:! Text (Object::toString [] (Object::getClass [] (:! Object value))))] + (let [value-text (:coerce Text (Object::toString [] (:coerce Object value))) + class-text (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object value))))] (format value-text " : " class-text))) (def: (parse-variant lux-object host-object) (-> (-> Object (Error Any)) Pair (Error Any)) (let [variant-tag (Pair::getCar [] host-object)] (if (and (host.instance? gnu/mapping/SimpleSymbol variant-tag) - (text/= //.variant-tag (Symbol::getName [] (:! Symbol variant-tag)))) + (text/= //.variant-tag (Symbol::getName [] (:coerce Symbol variant-tag)))) (do e.Monad<Error> - [#let [host-object (:! Pair (Pair::getCdr [] host-object))] + [#let [host-object (:coerce Pair (Pair::getCdr [] host-object))] tag (lux-object (Pair::getCar [] host-object)) - #let [host-object (:! Pair (Pair::getCdr [] host-object))] + #let [host-object (:coerce Pair (Pair::getCdr [] host-object))] #let [flag (host.instance? java/lang/String (Pair::getCar [] host-object))] value (lux-object (Pair::getCdr [] host-object))] - (wrap (..variant (:! Nat tag) flag value))) - (ex.throw invalid-variant (:! Text (Object::toString [] (:! Object host-object))))))) + (wrap (..variant (:coerce Nat tag) flag value))) + (ex.throw invalid-variant (:coerce Text (Object::toString [] (:coerce Object host-object))))))) (def: (lux-object host-object) (-> Object (Error Any)) @@ -109,32 +109,32 @@ (#e.Success host-object) (host.instance? gnu/math/IntNum host-object) - (#e.Success (IntNum::longValue [] (:! IntNum host-object))) + (#e.Success (IntNum::longValue [] (:coerce IntNum host-object))) (host.instance? gnu/math/DFloNum host-object) - (#e.Success (DFloNum::doubleValue [] (:! DFloNum host-object))) + (#e.Success (DFloNum::doubleValue [] (:coerce DFloNum host-object))) (host.instance? gnu/lists/FString host-object) - (#e.Success (FString::toString [] (:! FString host-object))) + (#e.Success (FString::toString [] (:coerce FString host-object))) (host.instance? gnu/lists/FVector host-object) - (parse-tuple lux-object (:! (FVector Object) host-object)) + (parse-tuple lux-object (:coerce (FVector Object) host-object)) (host.instance? gnu/lists/EmptyList host-object) (#e.Success //.unit) (host.instance? gnu/lists/Pair host-object) - (parse-variant lux-object (:! Pair host-object)) + (parse-variant lux-object (:coerce Pair host-object)) ## else - (let [object-class (:! Text (Object::toString [] (Object::getClass [] (:! Object host-object)))) - text-representation (:! Text (Object::toString [] (:! Object host-object)))] + (let [object-class (:coerce Text (Object::toString [] (Object::getClass [] (:coerce Object host-object)))) + text-representation (:coerce Text (Object::toString [] (:coerce Object host-object)))] (ex.throw Unknown-Kind-Of-Host-Object (format object-class " --- " text-representation))))) (def: #export (eval code) (-> Expression (Meta Any)) (function (_ compiler) - (let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))] + (let [interpreter (|> compiler (get@ #.host) (:coerce //.Host) (get@ #//.interpreter))] (case (interpreter code) (#e.Error error) (exec (log! (format "eval #e.Error\n" diff --git a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux index 43e18cb85..aa1411c18 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/statement.jvm.lux @@ -34,7 +34,7 @@ (wrap []) tags - (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (moduleL.declare-tags tags (macro.export? metaV) (:coerce Type expressionV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (wrap [])) |