aboutsummaryrefslogtreecommitdiff
path: root/lux-ruby
diff options
context:
space:
mode:
authorEduardo Julian2022-04-06 16:07:22 -0400
committerEduardo Julian2022-04-06 16:07:22 -0400
commita0ed5fd377daf5754697636504de8e180abf9ec0 (patch)
tree8cc47f78ac6557c4ba233e6debd7b836adfb65b1 /lux-ruby
parent0494295b95c5c44ef389f1259e408f9445cfe0a1 (diff)
More efficient binary parsing.
Diffstat (limited to 'lux-ruby')
-rw-r--r--lux-ruby/commands.md6
-rw-r--r--lux-ruby/project.lux3
-rw-r--r--lux-ruby/source/program.lux26
3 files changed, 18 insertions, 17 deletions
diff --git a/lux-ruby/commands.md b/lux-ruby/commands.md
index d998b0f84..0546f063f 100644
--- a/lux-ruby/commands.md
+++ b/lux-ruby/commands.md
@@ -28,14 +28,14 @@ cd ~/lux/stdlib/ \
```
cd ~/lux/lux-ruby/ \
-&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-ruby -Dversion=0.6.6-SNAPSHOT -Dpackaging=jar
+&& mvn install:install-file -Dfile=target/program.jar -DgroupId=com.github.luxlang -DartifactId=lux-ruby -Dversion=0.7.0-SNAPSHOT -Dpackaging=jar
cd ~/lux/lux-ruby/ && mvn deploy:deploy-file \
--Durl=https://USERNAME:PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
+-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \
-Dfile=target/program.jar \
-DgroupId=com.github.luxlang \
-DartifactId=lux-ruby \
--Dversion=0.6.5-SNAPSHOT \
+-Dversion=0.7.0-SNAPSHOT \
-Dpackaging=jar
```
diff --git a/lux-ruby/project.lux b/lux-ruby/project.lux
index de1979660..e23b606b2 100644
--- a/lux-ruby/project.lux
+++ b/lux-ruby/project.lux
@@ -15,8 +15,9 @@
"repositories" ["https://oss.sonatype.org/content/repositories/snapshots/"
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"]
- "lux" ["com.github.luxlang" "lux-jvm" "0.6.6-SNAPSHOT" "jar"]
+ "lux" ["com.github.luxlang" "lux-jvm" "0.7.0-SNAPSHOT" "jar"]
"dependencies" [... ["com.github.luxlang" "stdlib" "0.6.6-SNAPSHOT" "tar"]
+ ["com.github.luxlang" "lux-jvm-function" "0.6.5" "jar"]
["org.jruby" "jruby-complete" "9.2.15.0" "jar"]]
diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux
index 5b4da0caa..1e06e6664 100644
--- a/lux-ruby/source/program.lux
+++ b/lux-ruby/source/program.lux
@@ -114,10 +114,10 @@
(import: org/jruby/RubyClass
"[1]::[0]")
-(import: org/jruby/RubyArray
+(import: (org/jruby/RubyArray a)
"[1]::[0]"
(getLength [] int)
- (get [int] "?" Object))
+ (get [int] "?" java/lang/Object))
(import: org/jruby/RubyHash
"[1]::[0]"
@@ -233,7 +233,7 @@
(-> java/lang/Object (Try Any)))
(def: (read_tuple read host_object)
- (-> Translator org/jruby/RubyArray (Try Any))
+ (-> Translator (org/jruby/RubyArray org/jruby/runtime/builtin/IRubyObject) (Try Any))
(let [size (.nat (ffi.of_int (org/jruby/RubyArray::getLength host_object)))]
(loop (again [idx 0
output (is (Array Any)
@@ -245,11 +245,11 @@
{.#Some value}
(case (read value)
- {try.#Failure error}
- {try.#Failure error}
-
{try.#Success lux_value}
- (again (++ idx) (array.write! idx lux_value output))))
+ (again (++ idx) (array.has! idx lux_value output))
+
+ failure
+ failure))
{try.#Success output}))))
(exception: (unknown_kind_of_object [object java/lang/Object])
@@ -301,7 +301,7 @@
[org/jruby/RubyFixnum [org/jruby/RubyFixnum::getLongValue {try.#Success}]]
[org/jruby/RubyString [org/jruby/RubyString::asJavaString {try.#Success}]]
[[java/lang/Object] [{try.#Success}]]
- [org/jruby/RubyArray [(read_tuple read)]]
+ [org/jruby/RubyArray [(as (org/jruby/RubyArray org/jruby/runtime/builtin/IRubyObject)) (read_tuple read)]]
[org/jruby/RubyHash [(read_variant read)]]
[org/jruby/RubySymbol [{try.#Success}]]
[org/jruby/RubyProc [{try.#Success}]]
@@ -465,7 +465,7 @@
(let [member (ffi.read! 0 args)]
(<| (case (ffi.as org/jruby/RubyFixnum member)
{.#Some member}
- (case (array.read! (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value)
+ (case (array.item (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value)
{.#Some value}
(wrapped_lux_value (as_expected useful_object_class) lux_structure value)
@@ -478,7 +478,7 @@
(case (ffi.of_string (org/jruby/RubyString::asJavaString member))
(pattern (static runtime.variant_tag_field))
(|> value
- (array.read! 0)
+ (array.item 0)
maybe.trusted
(as java/lang/Integer)
java/lang/Integer::longValue
@@ -486,7 +486,7 @@
(ffi.is org/jruby/runtime/builtin/IRubyObject))
(pattern (static runtime.variant_flag_field))
- (case (array.read! 1 value)
+ (case (array.item 1 value)
{.#None}
..ruby_nil
@@ -494,7 +494,7 @@
..lux_unit)
(pattern (static runtime.variant_value_field))
- (case (array.read! 2 value)
+ (case (array.item 2 value)
{.#Some value}
(wrapped_lux_value (as_expected useful_object_class) lux_structure value)
@@ -691,7 +691,7 @@
(<| (ffi.is org/jruby/runtime/builtin/IRubyObject)
(org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime
(useful_object_class lux_structure value)
- (ffi.is java/lang/Object value))))
+ (as java/lang/Object value))))
(exception: (cannot_apply_a_non_function [object java/lang/Object])
(exception.report