From 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jun 2022 00:48:19 -0400 Subject: De-sigil-ification: suffix : [Part 13] --- lux-php/source/program.lux | 54 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'lux-php') diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index 1e117c033..a1c6db4b7 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -185,7 +185,7 @@ "Class" (java/lang/Object::toString (java/lang/Object::getClass object)) "Object" (java/lang/Object::toString object))) -(def: (value_wrapper lux_structure value) +(def (value_wrapper lux_structure value) (-> (-> (Array java/lang/Object) php/runtime/Memory) java/lang/Object php/runtime/Memory) (<| (if (ffi.null? value) (php/runtime/memory/NullMemory::INSTANCE)) @@ -224,10 +224,10 @@ (undefined) )) -(def: unit +(def unit (php/runtime/memory/StringMemory::new "")) -(def: (lux_structure value) +(def (lux_structure value) (-> (Array java/lang/Object) php/runtime/Memory) (`` (ffi.object [] php/runtime/Memory [program/StructureValue] @@ -307,7 +307,7 @@ (undefined))) ))) -(def: (read_tuple read host_object) +(def (read_tuple read host_object) (-> Reader php/runtime/memory/ArrayMemory (Try Any)) (let [size (|> host_object php/runtime/memory/ArrayMemory::size @@ -334,16 +334,16 @@ error))) {try.#Success output})))) -(def: variant_tag_field +(def variant_tag_field (php/runtime/memory/StringMemory::new runtime.variant_tag_field)) -(def: variant_value_field +(def variant_value_field (php/runtime/memory/StringMemory::new runtime.variant_value_field)) -(def: variant_flag_field +(def variant_flag_field (php/runtime/memory/StringMemory::new runtime.variant_flag_field)) -(def: (read_variant read host_object) +(def (read_variant read host_object) (-> Reader php/runtime/memory/ArrayMemory (Try Any)) (case [(|> host_object (php/runtime/memory/ArrayMemory::get ..variant_tag_field) @@ -374,10 +374,10 @@ (exception: .public nulll_has_no_lux_representation) -(def: tuple_size_field +(def tuple_size_field (php/runtime/memory/StringMemory::new runtime.tuple_size_field)) -(def: (read host_object) +(def (read host_object) Reader (`` (<| (~~ (with_template [ ] [(case (ffi.as host_object) @@ -428,16 +428,16 @@ "[1]::[0]" (new [])) -(def: (ensure_macro macro) +(def (ensure_macro macro) (-> Macro (Maybe php/runtime/memory/ObjectMemory)) (|> macro (as java/lang/Object) (ffi.as php/runtime/memory/ObjectMemory))) -(def: interpreter +(def interpreter (org/develnext/jphp/scripting/JPHPScriptEngine::new)) -(def: default_environment +(def default_environment php/runtime/env/Environment (|> ..interpreter java/lang/Object::getClass @@ -446,7 +446,7 @@ (java/lang/reflect/Field::get ..interpreter) (as php/runtime/env/Environment))) -(def: (call_macro inputs lux macro) +(def (call_macro inputs lux macro) (-> (List Code) Lux php/runtime/memory/ObjectMemory (Try (Try [Lux (List Code)]))) (<| as_expected (do try.monad @@ -459,7 +459,7 @@ (php/runtime/memory/ObjectMemory::value macro)))] (..read (as java/lang/Object output))))) -(def: (expander macro inputs lux) +(def (expander macro inputs lux) Expander (case (ensure_macro macro) {.#Some macro} @@ -468,7 +468,7 @@ {.#None} (exception.throw ..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) @@ -477,12 +477,12 @@ (..read output))))] (is (Host _.Expression _.Statement) (structure - (def: (evaluate! context code) + (def (evaluate! context code) (run! (_.return code))) - (def: execute! run!) + (def execute! run!) - (def: (define! context input) + (def (define! context input) (let [global (reference.artifact context) @global (_.global global)] (do try.monad @@ -491,18 +491,18 @@ value (run! (_.return @global))] (wrap [global value definition])))) - (def: (ingest context content) + (def (ingest context content) (|> content (at utf8.codec decoded) try.trusted (as _.Statement))) - (def: (re_learn context content) + (def (re_learn context content) (run! content)) - (def: (re_load context content) + (def (re_load context content) (do try.monad [_ (run! content)] (run! (_.return (_.var (reference.artifact context))))))))))) -(def: platform +(def platform (IO (Platform [Nat _.Label] _.Expression _.Statement)) (do io.monad [host ..host] @@ -512,14 +512,14 @@ platform.#runtime runtime.generate platform.#write (|>> _.code (at utf8.codec encoded))]))) -(def: (program context program) +(def (program context program) (Program _.Expression _.Statement) (_.; (_.apply/2 program [(runtime.lux//program_args _.command_line_arguments) _.null]))) (for @.old - (def: extender + (def extender Extender ... TODO: Stop relying on coercions ASAP. (<| (as Extender) @@ -550,11 +550,11 @@ (..read output)))) @.php - (def: (extender handler) + (def (extender handler) Extender (as_expected handler))) -(def: (declare_success! _) +(def (declare_success! _) (-> Any (Promise Any)) (promise.future (at world/program.default exit +0))) -- cgit v1.2.3