aboutsummaryrefslogtreecommitdiff
path: root/lux-cl/source
diff options
context:
space:
mode:
authorEduardo Julian2021-07-11 01:51:04 -0400
committerEduardo Julian2021-07-11 01:51:04 -0400
commitabe24425ced15fd784ef6c62d6f186af72b491db (patch)
tree42b6e3cbd179c83fae8941fa4b128b13afc766f5 /lux-cl/source
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'lux-cl/source')
-rw-r--r--lux-cl/source/program.lux46
1 files changed, 23 insertions, 23 deletions
diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux
index 1a3b767a4..c37367a2e 100644
--- a/lux-cl/source/program.lux
+++ b/lux-cl/source/program.lux
@@ -166,7 +166,7 @@
(-> Any org/armedbear/lisp/LispObject)
(let [to_sub (: (-> Any org/armedbear/lisp/LispObject)
(function (_ sub_value)
- (let [sub_value (:coerce java/lang/Object sub_value)]
+ (let [sub_value (:as java/lang/Object sub_value)]
(`` (<| (~~ (template [<type> <then>]
[(case (ffi.check <type> sub_value)
(#.Some sub_value)
@@ -181,29 +181,29 @@
[java/lang/String [org/armedbear/lisp/SimpleString::new]]
))
## else
- (:coerce org/armedbear/lisp/LispObject sub_value))))))]
+ (:as org/armedbear/lisp/LispObject sub_value))))))]
(`` (ffi.object [] org/armedbear/lisp/LispObject [program/LuxADT]
[]
## Methods
(program/LuxADT
[] (getValue self) java/lang/Object
- (:coerce java/lang/Object value))
+ (:as java/lang/Object value))
(org/armedbear/lisp/LispObject
[] (length self)
int
(|> value
- (:coerce (Array java/lang/Object))
+ (:as (Array java/lang/Object))
array.size
- (:coerce java/lang/Long)
+ (:as java/lang/Long)
java/lang/Number::intValue))
(~~ (template [<name>]
[(org/armedbear/lisp/LispObject
[] (<name> self {idx int})
org/armedbear/lisp/LispObject
- (case (array.read (|> idx java/lang/Integer::longValue (:coerce Nat))
- (:coerce (Array java/lang/Object) value))
+ (case (array.read (|> idx java/lang/Integer::longValue (:as Nat))
+ (:as (Array java/lang/Object) value))
(#.Some sub)
(to_sub sub)
@@ -222,7 +222,7 @@
(do try.monad
[tag (read (org/armedbear/lisp/LispObject::NTH +0 host_object))
value (read (org/armedbear/lisp/LispObject::NTH +2 host_object))]
- (wrap [(java/lang/Long::intValue (:coerce java/lang/Long tag))
+ (wrap [(java/lang/Long::intValue (:as java/lang/Long tag))
(case (ffi.check org/armedbear/lisp/Nil (org/armedbear/lisp/LispObject::NTH +1 host_object))
(#.Some _)
(: Any (ffi.null))
@@ -235,7 +235,7 @@
(-> (Reader org/armedbear/lisp/LispObject) (Reader org/armedbear/lisp/SimpleVector))
(let [size (.nat (org/armedbear/lisp/LispObject::length host_object))]
(loop [idx 0
- output (:coerce (Array Any) (array.new size))]
+ output (:as (Array Any) (array.new size))]
(if (n.< size idx)
## TODO: Start using "SVREF" instead of "elt" ASAP
(case (read (org/armedbear/lisp/LispObject::elt (.int idx) host_object))
@@ -243,7 +243,7 @@
(#try.Failure error)
(#try.Success member)
- (recur (inc idx) (array.write! idx (:coerce Any member) output)))
+ (recur (inc idx) (array.write! idx (:as Any member) output)))
(#try.Success output)))))
(def: (read host_object)
@@ -268,23 +268,23 @@
(#.Some host_object)
(if (is? (org/armedbear/lisp/Symbol::T) host_object)
(#try.Success true)
- (exception.throw ..unknown_kind_of_object (:coerce java/lang/Object host_object)))
+ (exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object)))
#.None)
## else
- (exception.throw ..unknown_kind_of_object (:coerce java/lang/Object host_object))
+ (exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object))
)))
(def: ensure_macro
(-> Macro (Maybe org/armedbear/lisp/Closure))
- (|>> (:coerce java/lang/Object) (ffi.check org/armedbear/lisp/Closure)))
+ (|>> (:as java/lang/Object) (ffi.check org/armedbear/lisp/Closure)))
(def: (call_macro inputs lux macro)
(-> (List Code) Lux org/armedbear/lisp/Closure (Try (Try [Lux (List Code)])))
(do try.monad
[raw_output (org/armedbear/lisp/LispObject::execute (..host_value inputs) (..host_value lux) macro)]
- (:coerce (Try (Try [Lux (List Code)]))
- (..read raw_output))))
+ (:as (Try (Try [Lux (List Code)]))
+ (..read raw_output))))
(def: (expander macro inputs lux)
Expander
@@ -293,7 +293,7 @@
(call_macro inputs lux macro)
#.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 Any) (_.Expression Any)))
@@ -322,7 +322,7 @@
(wrap [global value definition]))))
(def: (ingest context content)
- (|> content (\ encoding.utf8 decode) try.assume (:coerce (_.Expression Any))))
+ (|> content (\ encoding.utf8 decode) try.assume (:as (_.Expression Any))))
(def: (re_learn context content)
(run! content))
@@ -368,17 +368,17 @@
(def: extender
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)
(exec
("lux io log" "TODO: Extender")
(#try.Failure "TODO: Extender"))))