aboutsummaryrefslogtreecommitdiff
path: root/lux-python
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-python
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'lux-python')
-rw-r--r--lux-python/source/program.lux44
1 files changed, 22 insertions, 22 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index e1e3e48a3..2fc611fe4 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -124,7 +124,7 @@
(-> Translator Translator)
(let [size (|> host_object org/python/core/PyObject::__len__ .nat)]
(loop [idx 0
- output (:coerce (Array Any) (array.new size))]
+ output (:as (Array Any) (array.new size))]
(if (n.< size idx)
(case (org/python/core/PyObject::__getitem__ (.int idx) host_object)
(#try.Failure try)
@@ -207,7 +207,7 @@
(def: (ensure_macro macro)
(-> Macro (Maybe org/python/core/PyFunction))
- (ffi.check org/python/core/PyFunction (:coerce java/lang/Object macro)))
+ (ffi.check org/python/core/PyFunction (:as java/lang/Object macro)))
(def: object_class
(java/lang/Class java/lang/Object)
@@ -215,11 +215,11 @@
(def: to_host
(-> Any org/python/core/PyObject)
- (|>> (:coerce java/lang/Object) (org/python/core/PyArray::new ..object_class)))
+ (|>> (:as java/lang/Object) (org/python/core/PyArray::new ..object_class)))
(def: ensure_function
(-> Any (Maybe org/python/core/PyFunction))
- (|>> (:coerce java/lang/Object)
+ (|>> (:as java/lang/Object)
(ffi.check org/python/core/PyFunction)))
)
@@ -244,20 +244,20 @@
(case (..call_macro inputs lux macro)
(#try.Success output)
(|> output
- (:coerce org/python/core/PyObject)
+ (:as org/python/core/PyObject)
..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)))))
@.python
(def: (expander macro inputs lux)
Expander
- (#try.Success ((:coerce Macro' macro) inputs lux)))})
+ (#try.Success ((:as Macro' macro) inputs lux)))})
(for {@.old
(def: host
@@ -288,7 +288,7 @@
(|> content
(\ utf8.codec decode)
try.assume
- (:coerce (_.Statement Any))))
+ (:as (_.Statement Any))))
(def: (re_learn context content)
(execute! content))
@@ -327,7 +327,7 @@
(def: define! define!)
(def: (ingest context content)
- (|> content (\ utf8.codec decode) try.assume (:coerce (_.Statement Any))))
+ (|> content (\ utf8.codec decode) try.assume (:as (_.Statement Any))))
(def: (re_learn context content)
(execute! content))
@@ -366,7 +366,7 @@
[input/0 (..read input/0)]
(case partial_application
(^ (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)))
@@ -386,7 +386,7 @@
input/1 (..read input/1)]
(case partial_application
(^ (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)))
@@ -404,7 +404,7 @@
input/2 (..read 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)))
@@ -418,22 +418,22 @@
(def: (extender phase_wrapper)
(-> platform.Phase_Wrapper Extender)
## TODO: Stop relying on coercions ASAP.
- (<| (:coerce Extender)
+ (<| (:as Extender)
(function (_ handler))
- (:coerce Handler)
+ (:as Handler)
(function (_ name phase))
- (:coerce Phase)
+ (:as Phase)
(function (_ archive parameters))
- (:coerce Operation)
+ (:as Operation)
(function (_ state))
- (:coerce Try)
+ (:as Try)
try.assume
- (:coerce Try)
+ (:as Try)
(do try.monad
[handler (try.from_maybe (..ensure_function handler))
output (org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 5)
(ffi.array_write 0 (org/python/core/PyString::new name))
- (ffi.array_write 1 (:coerce org/python/core/PyObject (phase_wrapper phase)))
+ (ffi.array_write 1 (:as org/python/core/PyObject (phase_wrapper phase)))
(ffi.array_write 2 (..to_host archive))
(ffi.array_write 3 (..to_host parameters))
(ffi.array_write 4 (..to_host state)))
@@ -449,8 +449,8 @@
(-> Archive (runtime.Operation platform.Phase_Wrapper))
(do phase.monad
[]
- (wrap (:coerce platform.Phase_Wrapper
- (..host_phase (list))))))
+ (wrap (:as platform.Phase_Wrapper
+ (..host_phase (list))))))
(def: platform
(IO (Platform Register (_.Expression Any) (_.Statement Any)))