diff options
author | Eduardo Julian | 2019-04-09 18:59:33 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-04-09 18:59:33 -0400 |
commit | 6c3e9f8c02ce153380392ba5bc8eeb517de5f781 (patch) | |
tree | 758b5cfa843b040421299e8dfcd115ae3b79067d /lux-python/source | |
parent | 1a8f93c02a68d7b3968916c14155a391871d6340 (diff) |
WIP: Ruby compiler.
Diffstat (limited to 'lux-python/source')
-rw-r--r-- | lux-python/source/program.lux | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 3a7fc9cc9..3fbd8ccd6 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -106,9 +106,6 @@ #.None) (java/lang/Object::toString object))) -(import: #long org/python/core/PyType - (getName [] java/lang/String)) - (import: #long org/python/core/PyNone) (import: #long org/python/core/PyBoolean) (import: #long org/python/core/PyInteger) @@ -128,8 +125,7 @@ (__nonzero__ [] boolean) (__getitem__ [int] #try org/python/core/PyObject) (__getitem__ #as __getitem__dict [org/python/core/PyObject] #try org/python/core/PyObject) - (__len__ [] int) - (getType [] org/python/core/PyType)) + (__len__ [] int)) (import: #long org/python/core/PyFunction (__call__ [(Array org/python/core/PyObject)] org/python/core/PyObject)) @@ -165,10 +161,6 @@ (recur (inc idx) (array.write idx lux-value output)))) (#error.Success output))))) -(def: python-type - (-> org/python/core/PyObject Text) - (|>> org/python/core/PyObject::getType org/python/core/PyType::getName (:coerce Text))) - (exception: (unknown-kind-of-object {object java/lang/Object}) (exception.report ["Object" (java/lang/Object::toString object)])) @@ -228,15 +220,11 @@ [org/python/core/PyTuple (..read-variant read)] [org/python/core/PyList (..read-tuple read)] )) - (exec (log! (java/lang/Class::getCanonicalName - (java/lang/Object::getClass - (:coerce java/lang/Object host-object)))) - (log! (python-type host-object)) - (exception.throw ..unknown-kind-of-object host-object))))) + (exception.throw ..unknown-kind-of-object host-object)))) (exception: (cannot-apply-a-non-function {object java/lang/Object}) (exception.report - ["Object" (java/lang/Object::toString object)])) + ["Non-function" (java/lang/Object::toString object)])) (def: (ensure-macro macro) (-> Macro (Maybe org/python/core/PyFunction)) @@ -252,7 +240,7 @@ (def: (call-macro inputs lux macro) (-> (List Code) Lux org/python/core/PyFunction (Error (Error [Lux (List Code)]))) - (<| (:coerce (Error (Error [Lux (List Code)]))) + (<| :assume ..read (org/python/core/PyFunction::__call__ (|> (host.array org/python/core/PyObject 2) (host.array-write 0 (..to-host inputs)) |