aboutsummaryrefslogtreecommitdiff
path: root/lux-python
diff options
context:
space:
mode:
Diffstat (limited to 'lux-python')
-rw-r--r--lux-python/source/program.lux38
1 files changed, 18 insertions, 20 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index bdf2883ab..d42671d75 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -32,6 +32,8 @@
[tool
[compiler
[phase (#+ Operation Phase)]
+ [reference
+ [variable (#+ Register)]]
[language
[lux
[program (#+ Program)]
@@ -93,7 +95,7 @@
(import: org/python/core/PyFunction
["#::."
- (__call__ [[org/python/core/PyObject]] org/python/core/PyObject)])
+ (__call__ [[org/python/core/PyObject]] #try org/python/core/PyObject)])
(import: org/python/core/PyArray
["#::."
@@ -214,10 +216,10 @@
(-> (List Code) Lux org/python/core/PyFunction (Try (Try [Lux (List Code)])))
(:assume
(do try.monad
- [expansion (host.try (org/python/core/PyFunction::__call__ (|> (host.array org/python/core/PyObject 2)
- (host.array_write 0 (..to_host inputs))
- (host.array_write 1 (..to_host lux)))
- macro))]
+ [expansion (org/python/core/PyFunction::__call__ (|> (host.array org/python/core/PyObject 2)
+ (host.array_write 0 (..to_host inputs))
+ (host.array_write 1 (..to_host lux)))
+ macro)]
(..read expansion))))
(def: (expander macro inputs lux)
@@ -235,8 +237,7 @@
(#try.Failure error))
#.None
- (exception.throw ..cannot_apply_a_non_function (:coerce java/lang/Object macro)))
- )
+ (exception.throw ..cannot_apply_a_non_function (:coerce java/lang/Object macro))))
(def: host
(IO (Host (_.Expression Any) (_.Statement Any)))
@@ -248,9 +249,7 @@
(..read output))))
execute! (: (-> (_.Statement Any) (Try Any))
(function (execute! input)
- (do try.monad
- [_ (org/python/util/PythonInterpreter::exec (_.code input) interpreter)]
- (wrap []))))]
+ (org/python/util/PythonInterpreter::exec (_.code input) interpreter)))]
(: (Host (_.Expression Any) (_.Statement Any))
(structure
(def: evaluate! evaluate!)
@@ -276,7 +275,7 @@
(evaluate! context (_.var (reference.artifact context))))))))))
(def: platform
- (IO (Platform _.SVar (_.Expression Any) (_.Statement Any)))
+ (IO (Platform [Register _.SVar] (_.Expression Any) (_.Statement Any)))
(do io.monad
[host ..host]
(wrap {#platform.&file_system (file.async file.default)
@@ -311,14 +310,13 @@
(:coerce Try)
(do try.monad
[handler (try.from_maybe (..ensure_function handler))
- output (host.try
- (org/python/core/PyFunction::__call__ (|> (host.array org/python/core/PyObject 5)
- (host.array_write 0 (org/python/core/PyString::new name))
- (host.array_write 1 (..to_host phase))
- (host.array_write 2 (..to_host archive))
- (host.array_write 3 (..to_host parameters))
- (host.array_write 4 (..to_host state)))
- handler))]
+ output (org/python/core/PyFunction::__call__ (|> (host.array org/python/core/PyObject 5)
+ (host.array_write 0 (org/python/core/PyString::new name))
+ (host.array_write 1 (..to_host phase))
+ (host.array_write 2 (..to_host archive))
+ (host.array_write 3 (..to_host parameters))
+ (host.array_write 4 (..to_host state)))
+ handler)]
(..read output))))
@.python
@@ -351,7 +349,7 @@
generation.bundle
extension/bundle.empty
..program
- [_.SVar (type (_.Expression Any)) (type (_.Statement Any))]
+ [(& Register _.SVar) (type (_.Expression Any)) (type (_.Statement Any))]
..extender
service
[(packager.package (<| (_.comment "-*- coding: utf-8 -*-")