diff options
author | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
commit | 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 (patch) | |
tree | 115fab5bd8a5f53dc0d13ce5453095324a83496f /lux-ruby | |
parent | f92c806ee8da63f04bbefbf558f6249bacdb47ea (diff) |
De-sigil-ification: suffix : [Part 13]
Diffstat (limited to '')
-rw-r--r-- | lux-ruby/source/program.lux | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 83a565329..41f03bb56 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -151,21 +151,21 @@ (getProvider [] org/jruby/embed/internal/LocalContextProvider)) ... TODO; Figure out a way to not need "interpreter" to be a global variable. -(def: interpreter +(def interpreter (org/jruby/embed/ScriptingContainer::new)) -(def: !ruby_runtime +(def !ruby_runtime (template (!ruby_runtime) [(|> ..interpreter org/jruby/embed/ScriptingContainer::getProvider org/jruby/embed/internal/LocalContextProvider::getRuntime)])) -(def: !ruby_thread_context +(def !ruby_thread_context (template (!ruby_thread_context) [(|> (!ruby_runtime) org/jruby/Ruby::getCurrentContext)])) -(def: initial_ruby_runtime +(def initial_ruby_runtime (!ruby_runtime)) (import org/jruby/java/proxies/JavaProxy @@ -231,7 +231,7 @@ (type: Translator (-> java/lang/Object (Try Any))) -(def: (read_tuple read host_object) +(def (read_tuple read host_object) (-> Translator (org/jruby/RubyArray org/jruby/runtime/builtin/IRubyObject) (Try Any)) (let [size (.nat (ffi.of_int (org/jruby/RubyArray::getLength host_object)))] (loop (again [idx 0 @@ -256,7 +256,7 @@ "Class" (ffi.of_string (java/lang/Object::toString (java/lang/Object::getClass object))) "Object" (ffi.of_string (java/lang/Object::toString object)))) -(def: (read_variant read host_object) +(def (read_variant read host_object) (-> Translator org/jruby/RubyHash (Try Any)) (case [(org/jruby/RubyHash::get (ffi.as_string runtime.variant_tag_field) host_object) (org/jruby/RubyHash::get (ffi.as_string runtime.variant_flag_field) host_object) @@ -282,7 +282,7 @@ (exception: .public nil_has_no_lux_representation) -(def: (read host_object) +(def (read host_object) Translator (`` (<| (if (ffi.null? host_object) (exception.except ..nil_has_no_lux_representation [])) @@ -310,16 +310,16 @@ {try.#Success host_object} ))) -(def: ruby_nil +(def ruby_nil org/jruby/runtime/builtin/IRubyObject (org/jruby/Ruby::getNil ..initial_ruby_runtime)) -(def: lux_unit +(def lux_unit org/jruby/runtime/builtin/IRubyObject (<| (ffi.is org/jruby/runtime/builtin/IRubyObject) (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime (ffi.as_string "")))) -(def: (wrapped_lux_value useful_object_class lux_structure) +(def (wrapped_lux_value useful_object_class lux_structure) (-> (-> (-> java/lang/Object org/jruby/runtime/builtin/IRubyObject) (Array java/lang/Object) org/jruby/RubyClass) @@ -370,7 +370,7 @@ (exception.report "Arity" (%.nat arity))) -(def: (::call useful_object_class lux_structure value) +(def (::call useful_object_class lux_structure value) (-> (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (Array java/lang/Object) org/jruby/RubyClass) @@ -438,7 +438,7 @@ (exception.except ..invalid_arity [arity]))] (in (wrapped_lux_value (as_expected useful_object_class) lux_structure output))))))))) -(def: (::access useful_object_class lux_structure value) +(def (::access useful_object_class lux_structure value) (-> (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (Array java/lang/Object) org/jruby/RubyClass) @@ -519,7 +519,7 @@ {.#None}) (panic! (exception.error ..invalid_index [(ffi.is java/lang/Object member)])))))))) -(def: (::= value) +(def (::= value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] @@ -551,7 +551,7 @@ {try.#Failure error} false)))))) -(def: (::length value) +(def (::length value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] @@ -577,7 +577,7 @@ (org/jruby/RubyFixnum::new ..initial_ruby_runtime) (ffi.is org/jruby/runtime/builtin/IRubyObject)))))) -(def: (::to_s value) +(def (::to_s value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] @@ -606,7 +606,7 @@ (exception.report "Method" (%.text method))) -(def: (::respond_to? value) +(def (::respond_to? value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] @@ -652,7 +652,7 @@ (exception.report "Method" (%.text method))) -(def: (useful_object_class lux_structure value) +(def (useful_object_class lux_structure value) (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (Array java/lang/Object) org/jruby/RubyClass) @@ -685,7 +685,7 @@ method (panic! (exception.error ..unknown_method [method]))))))) -(def: (lux_structure value) +(def (lux_structure value) (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (<| (ffi.is org/jruby/runtime/builtin/IRubyObject) (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime @@ -696,17 +696,17 @@ (exception.report "Non-function" (ffi.of_string (java/lang/Object::toString object)))) -(def: macro! +(def macro! (-> Macro (Maybe org/jruby/RubyProc)) (|>> (as java/lang/Object) (ffi.as org/jruby/RubyProc))) -(def: to_host +(def to_host (-> Any org/jruby/runtime/builtin/IRubyObject) (|>> (as (Array java/lang/Object)) ..lux_structure)) -(def: (call_macro inputs lux macro) +(def (call_macro inputs lux macro) (-> (List Code) Lux org/jruby/RubyProc (Try (Try [Lux (List Code)]))) (as_expected (do try.monad @@ -717,7 +717,7 @@ macro)] (..read (ffi.is java/lang/Object expansion))))) -(def: (expander macro inputs lux) +(def (expander macro inputs lux) Expander (case (macro! macro) {.#Some macro} @@ -734,7 +734,7 @@ {.#None} (exception.except ..cannot_apply_a_non_function [(as java/lang/Object macro)]))) -(def: host +(def host (IO (Host _.Expression _.Statement)) (io (let [run! (is (-> (_.Code Any) (Try Any)) (function (_ code) @@ -744,12 +744,12 @@ output)))))] (is (Host _.Expression _.Statement) (implementation - (def: (evaluate context [_ code]) + (def (evaluate context [_ code]) (run! code)) - (def: execute run!) + (def execute run!) - (def: (define context custom [_ input]) + (def (define context custom [_ input]) (let [global (maybe.else (reference.artifact context) custom) @global (_.global global)] @@ -758,16 +758,16 @@ value (run! definition)] (in [global value definition])))) - (def: (ingest context content) + (def (ingest context content) (|> content (at utf8.codec decoded) try.trusted (as _.Statement))) - (def: (re_learn context custom content) + (def (re_learn context custom content) (run! content)) - (def: (re_load context custom content) + (def (re_load context custom content) (do try.monad [_ (run! content)] (run! (_.global (reference.artifact context)))))))))) @@ -778,21 +778,21 @@ "Partial Application" (%.nat (list.size partial_application)) "Arity" (%.nat (list.size arity)))) - (def: proc_type + (def proc_type org/jruby/runtime/Block$Type (|> (org/jruby/runtime/Block::NULL_BLOCK) (org/jruby/runtime/Block::type))) - (def: phase_block_signature + (def phase_block_signature org/jruby/runtime/Signature (org/jruby/runtime/Signature::THREE_ARGUMENTS)) - (def: dummy_static_scope + (def dummy_static_scope org/jruby/parser/StaticScope (|> (org/jruby/parser/StaticScopeFactory::new (!ruby_runtime)) (org/jruby/parser/StaticScopeFactory::getDummyScope))) - (def: phase_block_body + (def phase_block_body org/jruby/runtime/BlockBody (<| (ffi.is org/jruby/runtime/BlockBody) (ffi.object [] org/jruby/runtime/BlockBody [] @@ -834,7 +834,7 @@ (undefined)) ))) - (def: (host_phase partial_application phase) + (def (host_phase partial_application phase) (All (_ s i o) (-> (List Any) (Phase [extension.Bundle s] i o) org/jruby/RubyProc)) @@ -917,7 +917,7 @@ (exception.except ..invaid_phase_application [partial_application inputs])))))] (org/jruby/RubyProc::newProc (!ruby_runtime) block ..proc_type))) - (def: (extender phase_wrapper) + (def (extender phase_wrapper) (-> phase.Wrapper Extender) ... TODO: Stop relying on coercions ASAP. (<| (as Extender) @@ -945,18 +945,18 @@ (..read (ffi.is java/lang/Object output)))))) @.ruby - (def: (extender phase_wrapper handler) + (def (extender phase_wrapper handler) (-> phase.Wrapper Extender) (as_expected handler))) -(def: (phase_wrapper archive) +(def (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (<| phase#in (as phase.Wrapper) (for @.jvm (..host_phase (list)) @.ruby (|>>)))) -(def: platform +(def platform (IO (Platform Register _.Expression _.Statement)) (do io.monad [host ..host] @@ -967,7 +967,7 @@ platform.#phase_wrapper ..phase_wrapper platform.#write (|>> _.code (at utf8.codec encoded))]))) -(def: (program context program) +(def (program context program) (Program _.Expression _.Statement) (let [normal_runtime? (_.do "const_defined?" (list (_.string (_.code _.command_line_arguments))) @@ -980,11 +980,11 @@ _.nil) program)))) -(def: (declare_success! _) +(def (declare_success! _) (-> Any (Async Any)) (async.future (at world/program.default exit +0))) -(def: (lux_compiler it) +(def (lux_compiler it) (-> Any platform.Custom) (undefined)) |