From 6c3e9f8c02ce153380392ba5bc8eeb517de5f781 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 9 Apr 2019 18:59:33 -0400 Subject: WIP: Ruby compiler. --- lux-python/source/program.lux | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'lux-python/source/program.lux') 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)) -- cgit v1.2.3