rVM envolves
Lately I got some chance to work more on rVM, and there is some good progress.
Just the day before version 0.0.12 was released and it steadily progresses towards the 0.1.0. 0.0.12 ships with some nifty new features which mostly results for the fact that I already got the chance to use rVM in two projects, and I’ve to admint I’d not thought it would really work out that well.
A few words to what is new, 0.0.12 now pretty completely covers ECMA script, of cause there are still some things that do not work like the option to create own objects is still missing and the support for leaving away ‘;’s in some places is missing. On the other hand it runs quite stable now and even passes most JSON test from http://json.org. Only some negative tests are not passes as the rVM compiler is too forgiving or implements non required features as allowing expressions within a associative array.
For the goal of making rVM easily usable, which is in my eyes one of the most important tasks, acts_as_rvm_type was added which allows to declare own objects as types for rVM in just a few lines.
Here a short example for that:
class Dog
attr_accessor :race, :name
include RVM::ActsAsRVMType
acts_as_rvm_type
register_variable :race, false # Declares race as a readonly variable in rVM
register_variable :name # Declares name as a writable variable for rVM
register_function :bark # Declares bark as a function of the dog object
def initalize race, name
@race = race
@name = name
end
def bark
puts "#{@name} barks!"
end
endThis is in my opinion a big step forward, and it works pretty smoothly with Rails which is nice, some time in the future I’ll add a rails plug in to make this even easier.
At another note due to adding a good few (still not enough I fear) specs to then rVM implementation lots of bugs were tossed away in the last few releases.
Visions
There are a few things I very much would love to see for rVM, one and perhaps the most ambitious is that with rVM it would be possible to run Tests or Specs over JavaScript code without the need of a browser – given it would take a good bit of effort and certainly some work to make the ECMA implementation more conform but I believe that it /is/ possible. Even now I think that for basic and well written JS code rVM might do the job in parsing and interpreting it correctly. But this is just a crazy idea for me ;) while it would be pretty darn cool to be able to do all tests of a rails app within ruby and no need for any foreign frameworks.
Trackbacks
Use the following link to trackback from your own site:
http://blog.licenser.net/trackbacks?article_id=48
