From 4965597043aca57a05760113f1851e96dad1eaf8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 14 Mar 2022 06:14:57 -0400 Subject: Leaner syntax for the "for" macro. --- lux-php/source/program.lux | 198 ++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 99 deletions(-) (limited to 'lux-php') diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index 0e2758238..383e89e5d 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -1,68 +1,68 @@ (.using - [lux "*" - [program {"+" program:}] - ["[0]" ffi] - ["[0]" debug] - [abstract - ["[0]" monad {"+" do}]] - [control - [pipe {"+" exec> case>}] - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO io}] - [concurrency - ["[0]" promise {"+" Promise}]]] - [data - ["[0]" text ("[1]#[0]" hash) - ["%" format {"+" format}] - [encoding - ["[0]" utf8]]] - [collection - ["[0]" array {"+" Array}]]] - [macro - ["[0]" template]] - [math - [number {"+" hex} - ["n" nat] - ["[0]" i64]]] - ["[0]" world "_" - ["[0]" file] - ["[1]/[0]" program]] - ["@" target - ["_" php]] - [tool - [compiler - [phase {"+" Operation Phase}] - [reference - [variable {"+" Register}]] - [language - [lux - [program {"+" Program}] - [generation {"+" Context Host}] - ["[0]" synthesis] - [analysis - [macro {"+" Expander}]] - [phase - ["[0]" extension {"+" Extender Handler} - ["[1]/[0]" bundle] - ["[0]" analysis "_" - ["[1]" php]] - ["[0]" generation "_" - ["[1]" php]]] - [generation - ["[0]" reference] - ["[0]" php - ["[0]" runtime]]]]]] - [default - ["[0]" platform {"+" Platform}]] - [meta - ["[0]" packager "_" - ["[1]" script]]]]]] - [program - ["/" compositor - ["[1][0]" cli] - ["[1][0]" static]]]) + [lux "*" + [program {"+" program:}] + ["[0]" ffi] + ["[0]" debug] + [abstract + ["[0]" monad {"+" do}]] + [control + [pipe {"+" exec> case>}] + ["[0]" maybe] + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO io}] + [concurrency + ["[0]" promise {"+" Promise}]]] + [data + ["[0]" text ("[1]#[0]" hash) + ["%" format {"+" format}] + [encoding + ["[0]" utf8]]] + [collection + ["[0]" array {"+" Array}]]] + [macro + ["[0]" template]] + [math + [number {"+" hex} + ["n" nat] + ["[0]" i64]]] + ["[0]" world "_" + ["[0]" file] + ["[1]/[0]" program]] + ["@" target + ["_" php]] + [tool + [compiler + [phase {"+" Operation Phase}] + [reference + [variable {"+" Register}]] + [language + [lux + [program {"+" Program}] + [generation {"+" Context Host}] + ["[0]" synthesis] + [analysis + [macro {"+" Expander}]] + [phase + ["[0]" extension {"+" Extender Handler} + ["[1]/[0]" bundle] + ["[0]" analysis "_" + ["[1]" php]] + ["[0]" generation "_" + ["[1]" php]]] + [generation + ["[0]" reference] + ["[0]" php + ["[0]" runtime]]]]]] + [default + ["[0]" platform {"+" Platform}]] + [meta + ["[0]" packager "_" + ["[1]" script]]]]]] + [program + ["/" compositor + ["[1][0]" cli] + ["[1][0]" static]]]) (ffi.import: java/lang/String) @@ -513,41 +513,41 @@ [(runtime.lux//program_args _.command_line_arguments) _.null]))) -(for [@.old - (def: extender - Extender - ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) - (function (@self handler)) - (:as Handler) - (function (@self name phase)) - (:as Phase) - (function (@self archive parameters)) - (:as Operation) - (function (@self state)) - (:as Try) - try.trusted - (:as Try) - (do try.monad - [handler (try.from_maybe (..ensure_macro handler)) - #let [to_php (: (-> Any php/runtime/Memory) - (|>> (:as (Array java/lang/Object)) lux_structure (:as php/runtime/Memory)))] - output (php/runtime/lang/Closure::call ..default_environment - (|> (ffi.array php/runtime/Memory 6) - (ffi.write! 0 handler) - (ffi.write! 1 (php/runtime/memory/StringMemory::new name)) - (ffi.write! 2 (to_php phase)) - (ffi.write! 3 (to_php archive)) - (ffi.write! 4 (to_php parameters)) - (ffi.write! 5 (to_php state))) - (:as php/runtime/lang/Closure - (php/runtime/memory/ObjectMemory::value handler)))] - (..read output)))) - - @.php - (def: (extender handler) - Extender - (:expected handler))]) +(for @.old + (def: extender + Extender + ... TODO: Stop relying on coercions ASAP. + (<| (:as Extender) + (function (@self handler)) + (:as Handler) + (function (@self name phase)) + (:as Phase) + (function (@self archive parameters)) + (:as Operation) + (function (@self state)) + (:as Try) + try.trusted + (:as Try) + (do try.monad + [handler (try.from_maybe (..ensure_macro handler)) + #let [to_php (: (-> Any php/runtime/Memory) + (|>> (:as (Array java/lang/Object)) lux_structure (:as php/runtime/Memory)))] + output (php/runtime/lang/Closure::call ..default_environment + (|> (ffi.array php/runtime/Memory 6) + (ffi.write! 0 handler) + (ffi.write! 1 (php/runtime/memory/StringMemory::new name)) + (ffi.write! 2 (to_php phase)) + (ffi.write! 3 (to_php archive)) + (ffi.write! 4 (to_php parameters)) + (ffi.write! 5 (to_php state))) + (:as php/runtime/lang/Closure + (php/runtime/memory/ObjectMemory::value handler)))] + (..read output)))) + + @.php + (def: (extender handler) + Extender + (:expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) -- cgit v1.2.3