From bc36487224f670c23002cc4575c0dba3e5dc1be1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 15 Mar 2022 07:24:35 -0400 Subject: De-sigil-ification: ^ --- lux-ruby/source/program.lux | 63 +++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'lux-ruby/source') diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 026032a4b..a4677a5ee 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -27,6 +27,7 @@ ["[0]" list ("[1]#[0]" functor)]]] ["[0]" macro [syntax {"+" syntax:}] + ["^" pattern] ["[0]" template]] [math [number {"+" hex} @@ -402,35 +403,35 @@ (ffi.read! index args))) (monad.each ! (|>> (ffi.:as java/lang/Object) ..read))) output (case args - (^ (list arg/0)) + (pattern (list arg/0)) (in ((:as (-> Any java/lang/Object) value) arg/0)) - (^ (list arg/0 arg/1)) + (pattern (list arg/0 arg/1)) (in ((:as (-> Any Any java/lang/Object) value) arg/0 arg/1)) - (^ (list arg/0 arg/1 arg/2)) + (pattern (list arg/0 arg/1 arg/2)) (in ((:as (-> Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2)) - (^ (list arg/0 arg/1 arg/2 arg/3)) + (pattern (list arg/0 arg/1 arg/2 arg/3)) (in ((:as (-> Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3)) - (^ (list arg/0 arg/1 arg/2 arg/3 arg/4)) + (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4)) (in ((:as (-> Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4)) - (^ (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5)) + (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5)) (in ((:as (-> Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5)) - (^ (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6)) + (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6)) (in ((:as (-> Any Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6)) - (^ (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6 arg/7)) + (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6 arg/7)) (in ((:as (-> Any Any Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6 arg/7)) @@ -475,7 +476,7 @@ (case (ffi.check org/jruby/RubyString member) {.#Some member} (case (ffi.of_string (org/jruby/RubyString::asJavaString member)) - (^ (static runtime.variant_tag_field)) + (pattern (static runtime.variant_tag_field)) (|> value (array.read! 0) maybe.trusted @@ -484,7 +485,7 @@ (org/jruby/RubyFixnum::new ..initial_ruby_runtime) (ffi.:as org/jruby/runtime/builtin/IRubyObject)) - (^ (static runtime.variant_flag_field)) + (pattern (static runtime.variant_flag_field)) (case (array.read! 1 value) {.#None} ..ruby_nil @@ -492,7 +493,7 @@ {.#Some flag} ..lux_unit) - (^ (static runtime.variant_value_field)) + (pattern (static runtime.variant_value_field)) (case (array.read! 2 value) {.#Some value} (wrapped_lux_value (:expected useful_object_class) lux_structure value) @@ -632,11 +633,11 @@ (|> (case (|> method org/jruby/RubySymbol::asJavaString ffi.of_string) - (^or "==" "equal?" - "to_s" "inspect" - "[]" "length" "respond_to?" - ... "to_hash" - ) + (^.or "==" "equal?" + "to_s" "inspect" + "[]" "length" "respond_to?" + ... "to_hash" + ) true _ @@ -670,13 +671,13 @@ "[]" (org/jruby/runtime/callsite/CacheEntry::new (::access useful_object_class lux_structure value) (ffi.as_int +1)) - (^or "==" "equal?") + (^.or "==" "equal?") (org/jruby/runtime/callsite/CacheEntry::new (::= value) (ffi.as_int +2)) - (^or "count" "length" "size") + (^.or "count" "length" "size") (org/jruby/runtime/callsite/CacheEntry::new (::length value) (ffi.as_int +3)) - (^or "to_s" "inspect") + (^.or "to_s" "inspect") (org/jruby/runtime/callsite/CacheEntry::new (::to_s value) (ffi.as_int +4)) "respond_to?" @@ -853,9 +854,9 @@ (monad.each ! (|>> (ffi.:as java/lang/Object) ..read)))]) (case inputs ... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value. - (^ (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host)) + (pattern (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host)) (case partial_application - (^ (list partial/0 partial/1)) + (pattern (list partial/0 partial/1)) (in (..to_host ((:as (-> Any Any Any Any) phase) partial/0 partial/1 @@ -864,21 +865,21 @@ _ (exception.except ..invaid_phase_application [partial_application inputs])) - (^ (list)) + (pattern (list)) {try.#Success (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) (host_phase partial_application phase))} - (^ (list input/0)) + (pattern (list input/0)) (case partial_application - (^ (list)) + (pattern (list)) (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0) phase))) - (^ (list partial/0)) + (pattern (list partial/0)) (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) (host_phase (list partial/0 input/0) phase))) - (^ (list partial/0 partial/1)) + (pattern (list partial/0 partial/1)) (in (..to_host ((:as (-> Any Any Any Any) phase) partial/0 partial/1 @@ -887,13 +888,13 @@ _ (exception.except ..invaid_phase_application [partial_application inputs])) - (^ (list input/0 input/1)) + (pattern (list input/0 input/1)) (case partial_application - (^ (list)) + (pattern (list)) (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0 input/1) phase))) - (^ (list partial/0)) + (pattern (list partial/0)) (in (..to_host ((:as (-> Any Any Any Any) phase) partial/0 input/0 @@ -902,9 +903,9 @@ _ (exception.except ..invaid_phase_application [partial_application inputs])) - (^ (list input/0 input/1 input/2)) + (pattern (list input/0 input/1 input/2)) (case partial_application - (^ (list)) + (pattern (list)) (in (..to_host ((:as (-> Any Any Any Any) phase) input/0 input/1 -- cgit v1.2.3