aboutsummaryrefslogtreecommitdiff
path: root/lux-ruby
diff options
context:
space:
mode:
authorEduardo Julian2022-03-30 15:25:06 -0400
committerEduardo Julian2022-03-30 15:25:06 -0400
commit9df5ff6abc6e95c766d1907c5a9fee00730e749a (patch)
tree8614095c2c2a3a5cd195f9e6da53f47c88891381 /lux-ruby
parent8ebc505f1be8e103039d220b2d824dd687777f24 (diff)
Re-named ffi.as to "is", and ffi.check to "as", to line the names up with normal type-annotation macros.
Diffstat (limited to 'lux-ruby')
-rw-r--r--lux-ruby/source/program.lux82
1 files changed, 41 insertions, 41 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 6270cba1c..5b4da0caa 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -279,7 +279,7 @@
(is Any value)]))
_
- (exception.except ..unknown_kind_of_object [(ffi.as java/lang/Object host_object)])))
+ (exception.except ..unknown_kind_of_object [(ffi.is java/lang/Object host_object)])))
(exception: .public nil_has_no_lux_representation)
@@ -288,7 +288,7 @@
(`` (<| (if (ffi.null? host_object)
(exception.except ..nil_has_no_lux_representation []))
(~~ (template [<class> <post_processing>]
- [(case (ffi.check <class> host_object)
+ [(case (ffi.as <class> host_object)
{.#Some typed_object}
(`` (|> typed_object (~~ (template.spliced <post_processing>))))
@@ -317,7 +317,7 @@
(def: lux_unit
org/jruby/runtime/builtin/IRubyObject
- (<| (ffi.as 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)
@@ -328,11 +328,11 @@
(-> java/lang/Object org/jruby/runtime/builtin/IRubyObject))
(function (again value)
(`` (<| (~~ (template [<when> <then>]
- [(case (ffi.check <when> value)
+ [(case (ffi.as <when> value)
{.#Some value}
(|> value
<then>
- (ffi.as org/jruby/runtime/builtin/IRubyObject))
+ (ffi.is org/jruby/runtime/builtin/IRubyObject))
{.#None})]
@@ -344,10 +344,10 @@
[org/jruby/runtime/builtin/IRubyObject (<|)]
))
... (as org/jruby/runtime/builtin/IRubyObject value)
- (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime
(useful_object_class again (as (Array java/lang/Object) value))
- (ffi.as java/lang/Object value)))))))
+ (ffi.is java/lang/Object value)))))))
(exception: (invalid_variant_access [field Text])
(exception.report
@@ -377,7 +377,7 @@
org/jruby/RubyClass)
(-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod))
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "call")]
@@ -401,7 +401,7 @@
list.indices
(list#each (function (_ index)
(ffi.read! index args)))
- (monad.each ! (|>> (ffi.as java/lang/Object) ..read)))
+ (monad.each ! (|>> (ffi.is java/lang/Object) ..read)))
output (case args
(pattern (list arg/0))
(in ((as (-> Any java/lang/Object) value)
@@ -445,7 +445,7 @@
org/jruby/RubyClass)
(-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod))
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "[]")]
@@ -463,7 +463,7 @@
block org/jruby/runtime/Block])
org/jruby/runtime/builtin/IRubyObject
(let [member (ffi.read! 0 args)]
- (<| (case (ffi.check org/jruby/RubyFixnum member)
+ (<| (case (ffi.as org/jruby/RubyFixnum member)
{.#Some member}
(case (array.read! (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value)
{.#Some value}
@@ -473,7 +473,7 @@
..ruby_nil)
{.#None})
- (case (ffi.check org/jruby/RubyString member)
+ (case (ffi.as org/jruby/RubyString member)
{.#Some member}
(case (ffi.of_string (org/jruby/RubyString::asJavaString member))
(pattern (static runtime.variant_tag_field))
@@ -483,7 +483,7 @@
(as java/lang/Integer)
java/lang/Integer::longValue
(org/jruby/RubyFixnum::new ..initial_ruby_runtime)
- (ffi.as org/jruby/runtime/builtin/IRubyObject))
+ (ffi.is org/jruby/runtime/builtin/IRubyObject))
(pattern (static runtime.variant_flag_field))
(case (array.read! 1 value)
@@ -505,24 +505,24 @@
(panic! (exception.error ..invalid_variant_access [field])))
{.#None})
- (case (ffi.check org/jruby/RubyRange member)
+ (case (ffi.as org/jruby/RubyRange member)
{.#Some member}
- (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.check org/jruby/RubyFixnum))
- (|> member (org/jruby/RubyRange::size thread_context) (ffi.check org/jruby/RubyFixnum))]
+ (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.as org/jruby/RubyFixnum))
+ (|> member (org/jruby/RubyRange::size thread_context) (ffi.as org/jruby/RubyFixnum))]
[{.#Some first} {.#Some size}]
(let [first (ffi.of_long (org/jruby/RubyFixnum::getLongValue first))
size (ffi.of_long (org/jruby/RubyFixnum::getLongValue size))]
(lux_structure (java/util/Arrays::copyOfRange value (ffi.as_int first) (ffi.as_int (i.+ first size)))))
_
- (panic! (exception.error ..invalid_index [(ffi.as java/lang/Object member)])))
+ (panic! (exception.error ..invalid_index [(ffi.is java/lang/Object member)])))
{.#None})
- (panic! (exception.error ..invalid_index [(ffi.as java/lang/Object member)]))))))))
+ (panic! (exception.error ..invalid_index [(ffi.is java/lang/Object member)]))))))))
(def: (::= value)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "==")]
@@ -539,12 +539,12 @@
args [org/jruby/runtime/builtin/IRubyObject]
block org/jruby/runtime/Block])
org/jruby/runtime/builtin/IRubyObject
- (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime)
ffi.as_boolean
(case (|> args
(ffi.read! 0)
- (ffi.as java/lang/Object)
+ (ffi.is java/lang/Object)
..read)
{try.#Success reference}
(same? (is Any reference) (is Any value))
@@ -554,7 +554,7 @@
(def: (::length value)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "length")]
@@ -576,11 +576,11 @@
.int
ffi.as_long
(org/jruby/RubyFixnum::new ..initial_ruby_runtime)
- (ffi.as org/jruby/runtime/builtin/IRubyObject))))))
+ (ffi.is org/jruby/runtime/builtin/IRubyObject))))))
(def: (::to_s value)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "to_s")]
@@ -601,7 +601,7 @@
debug.inspection
ffi.as_string
(org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime)
- (ffi.as org/jruby/runtime/builtin/IRubyObject))))))
+ (ffi.is org/jruby/runtime/builtin/IRubyObject))))))
(exception: (invalid_operation [method Text])
(exception.report
@@ -609,7 +609,7 @@
(def: (::respond_to? value)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)
- (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod)
+ (<| (ffi.is org/jruby/internal/runtime/methods/DynamicMethod)
(ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod []
[java/lang/String (ffi.as_string "respond_to?")]
@@ -628,7 +628,7 @@
org/jruby/runtime/builtin/IRubyObject
(case (|> args
(ffi.read! 0)
- (ffi.check org/jruby/RubySymbol))
+ (ffi.as org/jruby/RubySymbol))
{.#Some method}
(|> (case (|> method
org/jruby/RubySymbol::asJavaString
@@ -644,7 +644,7 @@
false)
ffi.as_boolean
(org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime)
- (ffi.as org/jruby/runtime/builtin/IRubyObject))
+ (ffi.is org/jruby/runtime/builtin/IRubyObject))
{.#None}
(panic! (exception.error ..invalid_operation ["respond_to?"])))))))
@@ -657,7 +657,7 @@
(-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject)
(Array java/lang/Object)
org/jruby/RubyClass)
- (<| (ffi.as org/jruby/RubyClass)
+ (<| (ffi.is org/jruby/RubyClass)
(ffi.object [] org/jruby/RubyClass []
[org/jruby/Ruby ..initial_ruby_runtime]
@@ -688,10 +688,10 @@
(def: (lux_structure value)
(-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject)
- (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime
(useful_object_class lux_structure value)
- (ffi.as java/lang/Object value))))
+ (ffi.is java/lang/Object value))))
(exception: (cannot_apply_a_non_function [object java/lang/Object])
(exception.report
@@ -700,7 +700,7 @@
(def: macro!
(-> Macro (Maybe org/jruby/RubyProc))
(|>> (as java/lang/Object)
- (ffi.check org/jruby/RubyProc)))
+ (ffi.as org/jruby/RubyProc)))
(def: to_host
(-> Any org/jruby/runtime/builtin/IRubyObject)
@@ -716,7 +716,7 @@
(ffi.write! 0 (..to_host inputs))
(ffi.write! 1 (..to_host lux)))
macro)]
- (..read (ffi.as java/lang/Object expansion)))))
+ (..read (ffi.is java/lang/Object expansion)))))
(def: (expander macro inputs lux)
Expander
@@ -795,7 +795,7 @@
(def: phase_block_body
org/jruby/runtime/BlockBody
- (<| (ffi.as org/jruby/runtime/BlockBody)
+ (<| (ffi.is org/jruby/runtime/BlockBody)
(ffi.object [] org/jruby/runtime/BlockBody []
[org/jruby/runtime/Signature ..phase_block_signature]
... Methods
@@ -851,7 +851,7 @@
(do [! try.monad]
[inputs (|> inputs
(array.list {.#None})
- (monad.each ! (|>> (ffi.as java/lang/Object) ..read)))])
+ (monad.each ! (|>> (ffi.is java/lang/Object) ..read)))])
(case inputs
... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value.
(pattern (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host))
@@ -866,17 +866,17 @@
(exception.except ..invaid_phase_application [partial_application inputs]))
(pattern (list))
- {try.#Success (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ {try.#Success (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase partial_application phase))}
(pattern (list input/0))
(case partial_application
(pattern (list))
- (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase (list input/0) phase)))
(pattern (list partial/0))
- (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase (list partial/0 input/0) phase)))
(pattern (list partial/0 partial/1))
@@ -891,7 +891,7 @@
(pattern (list input/0 input/1))
(case partial_application
(pattern (list))
- (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (in (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(host_phase (list input/0 input/1) phase)))
(pattern (list partial/0))
@@ -936,14 +936,14 @@
[handler (try.of_maybe (..macro! handler))
output (org/jruby/RubyProc::call (!ruby_thread_context)
(|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
- (ffi.write! 0 (<| (ffi.as org/jruby/runtime/builtin/IRubyObject)
+ (ffi.write! 0 (<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name))))
(ffi.write! 1 (as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
(ffi.write! 2 (..to_host archive))
(ffi.write! 3 (..to_host parameters))
(ffi.write! 4 (..to_host state)))
handler)]
- (..read (ffi.as java/lang/Object output))))))
+ (..read (ffi.is java/lang/Object output))))))
@.ruby
(def: (extender phase_wrapper handler)