-
Notifications
You must be signed in to change notification settings - Fork 21
Rubex v0.2 goals
This is a feature list for Rubex v0.2.
Particulars:
Table of Contents
-
Rubex mini proposal
- -
- Ability to run functions without the GIL
- Support tracebacks and giving precise information about wrong runtime code.
- Make Rubex aware of certain Ruby primitive data types like string, hash and array
- Support expressions containing assign statements.
- Find a way to integrate with Rails/sinatra/hanami
- Support require statements for Ruby code
- Support Ruby modules
- Support :: operator for separating constants
- Support for nesting modules and classes within each other
- Creating C APIs for Ruby gems
- GPU interfacing
One of the problems that exist with C extensions is that method calls to Ruby-land are extremely expensive. Thus, if Rubex is made aware that a particular Ruby object is of a specific type (like a String, Array or Hash), then certain methods called on that object can be directly optimized by Rubex by directly using optimizations from the CRuby C API, instead of going through a Ruby method call.
For example, if a statement like a.size
is encountered, and a
is a string, Rubex can directly translate this code to RSTRING_LEN(a)
instead of rb_funcall(a, rb_intern("size"), 0, NULL)
. The former is much faster the latter.
The string class in Ruby will be represented in Rubex with the string
data type, Hash with hash
and Array with array
. Code using these will look like this:
class RubyTypes
def these_types(string str, array arr, hash h)
str[4] = "a"
arr.append(44)
print str
print arr
print hash["fff"]
hash["fff"] = 565
print hash["fff"]
return hash
end
end
Something on the lines of:
if (a = 3) || (b == c)
end