diff options
Diffstat (limited to '')
-rw-r--r-- | lux-r/source/program.lux | 46 | ||||
-rw-r--r-- | lux-ruby/source/program.lux | 84 |
2 files changed, 65 insertions, 65 deletions
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux index 5e5523e83..a42c5f06d 100644 --- a/lux-r/source/program.lux +++ b/lux-r/source/program.lux @@ -183,7 +183,7 @@ (-> Any org/renjin/sexp/SEXP) (let [## to_sub (: (-> Any org/armedbear/lisp/LispObject) ## (function (_ sub_value) - ## (let [sub_value (:coerce java/lang/Object sub_value)] + ## (let [sub_value (:as java/lang/Object sub_value)] ## (`` (<| (~~ (template [<type> <then>] ## [(case (ffi.check <type> sub_value) ## (#.Some sub_value) @@ -198,7 +198,7 @@ ## [java/lang/String [org/armedbear/lisp/SimpleString::new]] ## )) ## ## else - ## (:coerce org/armedbear/lisp/LispObject sub_value)))))) + ## (:as org/armedbear/lisp/LispObject sub_value)))))) ] (`` (macro.log_expand_once! (ffi.object [] @@ -217,7 +217,7 @@ ## Methods ## (program/LuxADT ## [] (getValue self) java/lang/Object - ## (:coerce java/lang/Object value)) + ## (:as java/lang/Object value)) ## (org/renjin/sexp/AbstractSEXP ## [] (eval self {context org/renjin/eval/Context} {environment org/renjin/sexp/Environment}) @@ -351,13 +351,13 @@ (do try.monad [tag (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_tag_field) - (:coerce java/lang/Object) + (:as java/lang/Object) read) value (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_value_field) - (:coerce java/lang/Object) + (:as java/lang/Object) read)] - (wrap [(|> tag (:coerce java/lang/Long) java/lang/Long::intValue) + (wrap [(|> tag (:as java/lang/Long) java/lang/Long::intValue) (case (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_flag_field) (ffi.check org/renjin/sexp/Null)) @@ -387,14 +387,14 @@ (-> (Reader java/lang/Object) (Reader org/renjin/sexp/ListVector)) (let [size (.nat (org/renjin/sexp/ListVector::length host_object))] (loop [idx 0 - output (:coerce (Array Any) (array.new size))] + output (:as (Array Any) (array.new size))] (if (n.< size idx) - (case (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (:coerce java/lang/Object) read) + (case (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (:as java/lang/Object) read) (#try.Failure error) (#try.Failure error) (#try.Success member) - (recur (inc idx) (array.write! idx (:coerce Any member) output))) + (recur (inc idx) (array.write! idx (:as Any member) output))) (#try.Success output))))) (def: (field_class field host_object) @@ -403,7 +403,7 @@ (org/renjin/sexp/ListVector::get_field field) java/lang/Object::getClass java/lang/Object::toString - (:coerce Text))) + (:as Text))) (def: (read host_object) (Reader java/lang/Object) @@ -446,7 +446,7 @@ (def: ensure_macro (-> Macro (Maybe org/renjin/sexp/Closure)) - (|>> (:coerce java/lang/Object) (ffi.check org/renjin/sexp/Closure))) + (|>> (:as java/lang/Object) (ffi.check org/renjin/sexp/Closure))) (def: (call_macro interpreter inputs lux macro) (-> org/renjin/script/RenjinScriptEngine (List Code) Lux org/renjin/sexp/Closure (Try (Try [Lux (List Code)]))) @@ -456,7 +456,7 @@ (org/renjin/sexp/PairList$Builder::add (..host_value inputs)) (org/renjin/sexp/PairList$Builder::add (..host_value lux)) org/renjin/sexp/PairList$Builder::build - (:coerce org/renjin/sexp/PairList))) + (:as org/renjin/sexp/PairList))) (#try.Success r_inputs) r_inputs @@ -474,8 +474,8 @@ (do try.monad [raw_output (org/renjin/sexp/FunctionCall::eval r_context r_environment r_macro) #let [_ ("lux io log" "@call_macro 5")]] - (:coerce (Try (Try [Lux (List Code)])) - (..read (:coerce java/lang/Object raw_output)))))) + (:as (Try (Try [Lux (List Code)])) + (..read (:as java/lang/Object raw_output)))))) (def: (expander interpreter macro inputs lux) (-> org/renjin/script/RenjinScriptEngine Expander) @@ -484,7 +484,7 @@ (call_macro interpreter inputs lux macro) #.None - (exception.throw ..cannot_apply_a_non_function [(:coerce java/lang/Object macro)]))) + (exception.throw ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) (def: host (IO [org/renjin/script/RenjinScriptEngine @@ -496,7 +496,7 @@ (do try.monad [host_value (javax/script/ScriptEngine::eval (_.code code) interpreter)] (read host_value))))] - [(:coerce org/renjin/script/RenjinScriptEngine interpreter) + [(:as org/renjin/script/RenjinScriptEngine interpreter) (: (Host _.Expression _.Expression) (structure (def: (evaluate! context code) @@ -524,7 +524,7 @@ (wrap [global value definition])))) (def: (ingest context content) - (|> content (\ utf8.codec decode) try.assume (:coerce _.Expression))) + (|> content (\ utf8.codec decode) try.assume (:as _.Expression))) (def: (re_learn context content) (run! content)) @@ -555,17 +555,17 @@ (def: extender Extender ## TODO: Stop relying on coercions ASAP. - (<| (:coerce Extender) + (<| (:as Extender) (function (@self handler)) - (:coerce Handler) + (:as Handler) (function (@self name phase)) - (:coerce Phase) + (:as Phase) (function (@self archive parameters)) - (:coerce Operation) + (:as Operation) (function (@self state)) - (:coerce Try) + (:as Try) try.assume - (:coerce Try) + (:as Try) (exec ("lux io log" "TODO: Extender") (#try.Failure "TODO: Extender")))) diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 46ea78666..91d9980d2 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -236,9 +236,9 @@ (def: (read_tuple read host_object) (-> Translator org/jruby/RubyArray (Try Any)) - (let [size (:coerce Nat (org/jruby/RubyArray::getLength host_object))] + (let [size (:as Nat (org/jruby/RubyArray::getLength host_object))] (loop [idx 0 - output (:coerce (Array Any) (array.new size))] + output (:as (Array Any) (array.new size))] (if (n.< size idx) (case (org/jruby/RubyArray::get (.int idx) host_object) #.None @@ -266,7 +266,7 @@ (^multi [(#.Some tag) ?flag (#.Some value)] [(read value) (#.Some value)]) - (#try.Success [(java/lang/Long::intValue (:coerce java/lang/Long tag)) + (#try.Success [(java/lang/Long::intValue (:as java/lang/Long tag)) (: Any (case ?flag (#.Some _) "" @@ -318,7 +318,7 @@ (-> java/lang/Object org/jruby/runtime/builtin/IRubyObject)) (<| (case (ffi.check [java/lang/Object] value) (#.Some value) - (|> value (:coerce (Array java/lang/Object)) lux_structure) + (|> value (:as (Array java/lang/Object)) lux_structure) #.None) (case (ffi.check java/lang/Boolean value) @@ -341,7 +341,7 @@ (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime value) #.None) - (:coerce org/jruby/runtime/builtin/IRubyObject value))) + (:as org/jruby/runtime/builtin/IRubyObject value))) (exception: (invalid_variant_access {field Text}) (exception.report @@ -391,12 +391,12 @@ #.None) (case (ffi.check org/jruby/RubyString member) (#.Some member) - (case (:coerce Text (org/jruby/RubyString::asJavaString member)) + (case (:as Text (org/jruby/RubyString::asJavaString member)) (^ (static runtime.variant_tag_field)) (|> value (array.read 0) maybe.assume - (:coerce java/lang/Integer) + (:as java/lang/Integer) java/lang/Integer::longValue (org/jruby/RubyFixnum::new ..initial_ruby_runtime)) @@ -430,10 +430,10 @@ (lux_structure (java/util/Arrays::copyOfRange value first (i.+ first size)))) _ - (error! (exception.construct ..invalid_index (:coerce java/lang/Object member)))) + (error! (exception.construct ..invalid_index (:as java/lang/Object member)))) #.None) - (error! (exception.construct ..invalid_index (:coerce java/lang/Object member)))))))) + (error! (exception.construct ..invalid_index (:as java/lang/Object member)))))))) (def: (lux_wrapper_equality value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) @@ -450,7 +450,7 @@ {block org/jruby/runtime/Block}) org/jruby/runtime/builtin/IRubyObject (let [reference (ffi.array_read 0 args)] - (case (..read (:coerce java/lang/Object reference)) + (case (..read (:as java/lang/Object reference)) (#try.Success reference) (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (is? (: Any reference) (: Any value))) @@ -517,7 +517,7 @@ (#.Some method) (|> (case (|> method org/jruby/RubySymbol::asJavaString - (:coerce Text)) + (:as Text)) (^or "==" "equal?" "to_s" "inspect" "[]" "length" "respond_to?" @@ -546,7 +546,7 @@ [] (searchWithCache self {method java/lang/String}) org/jruby/runtime/callsite/CacheEntry - (case (:coerce Text method) + (case (:as Text method) "[]" (org/jruby/runtime/callsite/CacheEntry::new (..lux_wrapper_access lux_structure value) 0) @@ -563,8 +563,8 @@ (org/jruby/runtime/callsite/CacheEntry::new (..lux_wrapper_respond_to? value) 4) _ - (error! (exception.construct ..unknown_method [(:coerce Text method)])))))] - (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime meta_class (:coerce java/lang/Object value)))) + (error! (exception.construct ..unknown_method [(:as Text method)])))))] + (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime meta_class (:as java/lang/Object value)))) (exception: (cannot_apply_a_non_function {object java/lang/Object}) (exception.report @@ -572,11 +572,11 @@ (def: ensure_macro (-> Macro (Maybe org/jruby/RubyProc)) - (|>> (:coerce java/lang/Object) (ffi.check org/jruby/RubyProc))) + (|>> (:as java/lang/Object) (ffi.check org/jruby/RubyProc))) (def: to_host (-> Any org/jruby/runtime/builtin/IRubyObject) - (|>> (:coerce (Array java/lang/Object)) + (|>> (:as (Array java/lang/Object)) ..lux_structure)) (def: (call_macro inputs lux macro) @@ -588,7 +588,7 @@ (ffi.array_write 0 (..to_host inputs)) (ffi.array_write 1 (..to_host lux))) macro)] - (..read (:coerce java/lang/Object expansion))))) + (..read (:as java/lang/Object expansion))))) (def: (expander macro inputs lux) Expander @@ -597,15 +597,15 @@ (case (call_macro inputs lux macro) (#try.Success output) (|> output - (:coerce java/lang/Object) + (:as java/lang/Object) ..read - (:coerce (Try (Try [Lux (List Code)])))) + (:as (Try (Try [Lux (List Code)])))) (#try.Failure error) (#try.Failure error)) #.None - (exception.throw ..cannot_apply_a_non_function [(:coerce java/lang/Object macro)]))) + (exception.throw ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) (def: host (IO (Host _.Expression _.Statement)) @@ -613,7 +613,7 @@ (function (_ code) (do try.monad [output (org/jruby/embed/ScriptingContainer::runScriptlet (_.code code) ..interpreter)] - (..read (maybe.default (:coerce java/lang/Object []) + (..read (maybe.default (:as java/lang/Object []) output)))))] (: (Host _.Expression _.Statement) (implementation @@ -634,7 +634,7 @@ (|> content (\ utf8.codec decode) try.assume - (:coerce _.Statement))) + (:as _.Statement))) (def: (re_learn context content) (run! content)) @@ -704,7 +704,7 @@ (^ (list input/0)) (do try.monad - [input/0 (..read (:coerce java/lang/Object input/0))] + [input/0 (..read (:as java/lang/Object input/0))] (case partial_application (^ (list)) (wrap (host_phase (list input/0) phase)) @@ -713,7 +713,7 @@ (wrap (host_phase (list partial/0 input/0) phase)) (^ (list partial/0 partial/1)) - (wrap (..to_host ((:coerce (-> Any Any Any Any) phase) + (wrap (..to_host ((:as (-> Any Any Any Any) phase) partial/0 partial/1 input/0))) @@ -723,14 +723,14 @@ (^ (list input/0 input/1)) (do try.monad - [input/0 (..read (:coerce java/lang/Object input/0)) - input/1 (..read (:coerce java/lang/Object input/1))] + [input/0 (..read (:as java/lang/Object input/0)) + input/1 (..read (:as java/lang/Object input/1))] (case partial_application (^ (list)) (wrap (host_phase (list input/0 input/1) phase)) (^ (list partial/0)) - (wrap (..to_host ((:coerce (-> Any Any Any Any) phase) + (wrap (..to_host ((:as (-> Any Any Any Any) phase) partial/0 input/0 input/1))) @@ -740,12 +740,12 @@ (^ (list input/0 input/1 input/2)) (do try.monad - [input/0 (..read (:coerce java/lang/Object input/0)) - input/1 (..read (:coerce java/lang/Object input/1)) - input/2 (..read (:coerce java/lang/Object input/2))] + [input/0 (..read (:as java/lang/Object input/0)) + input/1 (..read (:as java/lang/Object input/1)) + input/2 (..read (:as java/lang/Object input/2))] (case partial_application (^ (list)) - (wrap (..to_host ((:coerce (-> Any Any Any Any) phase) + (wrap (..to_host ((:as (-> Any Any Any Any) phase) input/0 input/1 input/2))) @@ -760,28 +760,28 @@ (def: (extender phase_wrapper) (-> platform.Phase_Wrapper Extender) ## TODO: Stop relying on coercions ASAP. - (<| (:coerce Extender) + (<| (:as Extender) (function (@self handler)) - (:coerce Handler) + (:as Handler) (function (@self name phase)) - (:coerce Phase) + (:as Phase) (function (@self archive parameters)) - (:coerce Operation) + (:as Operation) (function (@self state)) - (:coerce Try) + (:as Try) try.assume - (:coerce Try) + (:as Try) (do try.monad [handler (try.from_maybe (..ensure_macro handler)) output (org/jruby/RubyProc::call (!ruby_thread_context) (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5) (ffi.array_write 0 (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) name)) - (ffi.array_write 1 (:coerce org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase))) + (ffi.array_write 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase))) (ffi.array_write 2 (..to_host archive)) (ffi.array_write 3 (..to_host parameters)) (ffi.array_write 4 (..to_host state))) handler)] - (..read (:coerce java/lang/Object output)))))) + (..read (:as java/lang/Object output)))))) @.ruby (def: (extender phase_wrapper handler) @@ -792,9 +792,9 @@ (-> Archive (runtime.Operation platform.Phase_Wrapper)) (do phase.monad [] - (wrap (:coerce platform.Phase_Wrapper - (for {@.old (..host_phase (list)) - @.ruby (|>>)}))))) + (wrap (:as platform.Phase_Wrapper + (for {@.old (..host_phase (list)) + @.ruby (|>>)}))))) (def: platform (IO (Platform Register _.Expression _.Statement)) |