aboutsummaryrefslogtreecommitdiff
path: root/lux-ruby/source
diff options
context:
space:
mode:
Diffstat (limited to 'lux-ruby/source')
-rw-r--r--lux-ruby/source/program.lux84
1 files changed, 42 insertions, 42 deletions
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 46ea78666..91d9980d2 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -236,9 +236,9 @@
(def: (read_tuple read host_object)
(-> Translator org/jruby/RubyArray (Try Any))
- (let [size (:coerce Nat (org/jruby/RubyArray::getLength host_object))]
+ (let [size (:as Nat (org/jruby/RubyArray::getLength host_object))]
(loop [idx 0
- output (:coerce (Array Any) (array.new size))]
+ output (:as (Array Any) (array.new size))]
(if (n.< size idx)
(case (org/jruby/RubyArray::get (.int idx) host_object)
#.None
@@ -266,7 +266,7 @@
(^multi [(#.Some tag) ?flag (#.Some value)]
[(read value)
(#.Some value)])
- (#try.Success [(java/lang/Long::intValue (:coerce java/lang/Long tag))
+ (#try.Success [(java/lang/Long::intValue (:as java/lang/Long tag))
(: Any (case ?flag
(#.Some _)
""
@@ -318,7 +318,7 @@
(-> java/lang/Object org/jruby/runtime/builtin/IRubyObject))
(<| (case (ffi.check [java/lang/Object] value)
(#.Some value)
- (|> value (:coerce (Array java/lang/Object)) lux_structure)
+ (|> value (:as (Array java/lang/Object)) lux_structure)
#.None)
(case (ffi.check java/lang/Boolean value)
@@ -341,7 +341,7 @@
(org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime value)
#.None)
- (:coerce org/jruby/runtime/builtin/IRubyObject value)))
+ (:as org/jruby/runtime/builtin/IRubyObject value)))
(exception: (invalid_variant_access {field Text})
(exception.report
@@ -391,12 +391,12 @@
#.None)
(case (ffi.check org/jruby/RubyString member)
(#.Some member)
- (case (:coerce Text (org/jruby/RubyString::asJavaString member))
+ (case (:as Text (org/jruby/RubyString::asJavaString member))
(^ (static runtime.variant_tag_field))
(|> value
(array.read 0)
maybe.assume
- (:coerce java/lang/Integer)
+ (:as java/lang/Integer)
java/lang/Integer::longValue
(org/jruby/RubyFixnum::new ..initial_ruby_runtime))
@@ -430,10 +430,10 @@
(lux_structure (java/util/Arrays::copyOfRange value first (i.+ first size))))
_
- (error! (exception.construct ..invalid_index (:coerce java/lang/Object member))))
+ (error! (exception.construct ..invalid_index (:as java/lang/Object member))))
#.None)
- (error! (exception.construct ..invalid_index (:coerce java/lang/Object member))))))))
+ (error! (exception.construct ..invalid_index (:as java/lang/Object member))))))))
(def: (lux_wrapper_equality value)
(-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)
@@ -450,7 +450,7 @@
{block org/jruby/runtime/Block})
org/jruby/runtime/builtin/IRubyObject
(let [reference (ffi.array_read 0 args)]
- (case (..read (:coerce java/lang/Object reference))
+ (case (..read (:as java/lang/Object reference))
(#try.Success reference)
(org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (is? (: Any reference) (: Any value)))
@@ -517,7 +517,7 @@
(#.Some method)
(|> (case (|> method
org/jruby/RubySymbol::asJavaString
- (:coerce Text))
+ (:as Text))
(^or "==" "equal?"
"to_s" "inspect"
"[]" "length" "respond_to?"
@@ -546,7 +546,7 @@
[] (searchWithCache self
{method java/lang/String})
org/jruby/runtime/callsite/CacheEntry
- (case (:coerce Text method)
+ (case (:as Text method)
"[]"
(org/jruby/runtime/callsite/CacheEntry::new (..lux_wrapper_access lux_structure value) 0)
@@ -563,8 +563,8 @@
(org/jruby/runtime/callsite/CacheEntry::new (..lux_wrapper_respond_to? value) 4)
_
- (error! (exception.construct ..unknown_method [(:coerce Text method)])))))]
- (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime meta_class (:coerce java/lang/Object value))))
+ (error! (exception.construct ..unknown_method [(:as Text method)])))))]
+ (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime meta_class (:as java/lang/Object value))))
(exception: (cannot_apply_a_non_function {object java/lang/Object})
(exception.report
@@ -572,11 +572,11 @@
(def: ensure_macro
(-> Macro (Maybe org/jruby/RubyProc))
- (|>> (:coerce java/lang/Object) (ffi.check org/jruby/RubyProc)))
+ (|>> (:as java/lang/Object) (ffi.check org/jruby/RubyProc)))
(def: to_host
(-> Any org/jruby/runtime/builtin/IRubyObject)
- (|>> (:coerce (Array java/lang/Object))
+ (|>> (:as (Array java/lang/Object))
..lux_structure))
(def: (call_macro inputs lux macro)
@@ -588,7 +588,7 @@
(ffi.array_write 0 (..to_host inputs))
(ffi.array_write 1 (..to_host lux)))
macro)]
- (..read (:coerce java/lang/Object expansion)))))
+ (..read (:as java/lang/Object expansion)))))
(def: (expander macro inputs lux)
Expander
@@ -597,15 +597,15 @@
(case (call_macro inputs lux macro)
(#try.Success output)
(|> output
- (:coerce java/lang/Object)
+ (:as java/lang/Object)
..read
- (:coerce (Try (Try [Lux (List Code)]))))
+ (:as (Try (Try [Lux (List Code)]))))
(#try.Failure error)
(#try.Failure error))
#.None
- (exception.throw ..cannot_apply_a_non_function [(:coerce java/lang/Object macro)])))
+ (exception.throw ..cannot_apply_a_non_function [(:as java/lang/Object macro)])))
(def: host
(IO (Host _.Expression _.Statement))
@@ -613,7 +613,7 @@
(function (_ code)
(do try.monad
[output (org/jruby/embed/ScriptingContainer::runScriptlet (_.code code) ..interpreter)]
- (..read (maybe.default (:coerce java/lang/Object [])
+ (..read (maybe.default (:as java/lang/Object [])
output)))))]
(: (Host _.Expression _.Statement)
(implementation
@@ -634,7 +634,7 @@
(|> content
(\ utf8.codec decode)
try.assume
- (:coerce _.Statement)))
+ (:as _.Statement)))
(def: (re_learn context content)
(run! content))
@@ -704,7 +704,7 @@
(^ (list input/0))
(do try.monad
- [input/0 (..read (:coerce java/lang/Object input/0))]
+ [input/0 (..read (:as java/lang/Object input/0))]
(case partial_application
(^ (list))
(wrap (host_phase (list input/0) phase))
@@ -713,7 +713,7 @@
(wrap (host_phase (list partial/0 input/0) phase))
(^ (list partial/0 partial/1))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
partial/0
partial/1
input/0)))
@@ -723,14 +723,14 @@
(^ (list input/0 input/1))
(do try.monad
- [input/0 (..read (:coerce java/lang/Object input/0))
- input/1 (..read (:coerce java/lang/Object input/1))]
+ [input/0 (..read (:as java/lang/Object input/0))
+ input/1 (..read (:as java/lang/Object input/1))]
(case partial_application
(^ (list))
(wrap (host_phase (list input/0 input/1) phase))
(^ (list partial/0))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
partial/0
input/0
input/1)))
@@ -740,12 +740,12 @@
(^ (list input/0 input/1 input/2))
(do try.monad
- [input/0 (..read (:coerce java/lang/Object input/0))
- input/1 (..read (:coerce java/lang/Object input/1))
- input/2 (..read (:coerce java/lang/Object input/2))]
+ [input/0 (..read (:as java/lang/Object input/0))
+ input/1 (..read (:as java/lang/Object input/1))
+ input/2 (..read (:as java/lang/Object input/2))]
(case partial_application
(^ (list))
- (wrap (..to_host ((:coerce (-> Any Any Any Any) phase)
+ (wrap (..to_host ((:as (-> Any Any Any Any) phase)
input/0
input/1
input/2)))
@@ -760,28 +760,28 @@
(def: (extender phase_wrapper)
(-> platform.Phase_Wrapper Extender)
## TODO: Stop relying on coercions ASAP.
- (<| (:coerce Extender)
+ (<| (:as Extender)
(function (@self handler))
- (:coerce Handler)
+ (:as Handler)
(function (@self name phase))
- (:coerce Phase)
+ (:as Phase)
(function (@self archive parameters))
- (:coerce Operation)
+ (:as Operation)
(function (@self state))
- (:coerce Try)
+ (:as Try)
try.assume
- (:coerce Try)
+ (:as Try)
(do try.monad
[handler (try.from_maybe (..ensure_macro handler))
output (org/jruby/RubyProc::call (!ruby_thread_context)
(|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5)
(ffi.array_write 0 (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) name))
- (ffi.array_write 1 (:coerce org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
+ (ffi.array_write 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase)))
(ffi.array_write 2 (..to_host archive))
(ffi.array_write 3 (..to_host parameters))
(ffi.array_write 4 (..to_host state)))
handler)]
- (..read (:coerce java/lang/Object output))))))
+ (..read (:as java/lang/Object output))))))
@.ruby
(def: (extender phase_wrapper handler)
@@ -792,9 +792,9 @@
(-> Archive (runtime.Operation platform.Phase_Wrapper))
(do phase.monad
[]
- (wrap (:coerce platform.Phase_Wrapper
- (for {@.old (..host_phase (list))
- @.ruby (|>>)})))))
+ (wrap (:as platform.Phase_Wrapper
+ (for {@.old (..host_phase (list))
+ @.ruby (|>>)})))))
(def: platform
(IO (Platform Register _.Expression _.Statement))