14 comments

[ 43.6 ms ] story [ 589 ms ] thread
I was at a talk on mruby at a recent conference. It's some interesting stuff: the program size footprint is only something like 40k , and memory usage is around the same when running. It was initially meant for embedded systems, but seeing it here is also an interesting use case.
Since this project depends on webruby and webruby uses emscripten, it could get close to 2x native performance in browser(only firefox nightly) because of the awesome asm.js support.

I am a big supporter of asm.js after reading John Resig's post on it(http://ejohn.org/blog/asmjs-javascript-compile-target/).

Cool! When I read the title I immediately thought - it must be done via emscripten, and it turned out that I was right :)
Nice to see! Some things are working very well:

  >> class Fixnum; def even?; self%2==0; end; end;
  >> (1..100).to_a.select{|i| i.even? }
But some basic things are broken:

  >> n = 5
  => 5
  >> n
  => RuntimeError: arena overflow error
local scope is now fixed.
It'd be nice if someone could show an example of a webpage embedding some ruby code interacting with some js code/framework or something like html5 canvas. Just to see how they "communicate".
I remember you could also get it into iOS. Perfect if you wanted to script some stuff in Ruby. I'm currently using JS for that, but Ruby should do as well.
Multiplying two large Fixnum, gives a float value.
Javascript doesn't have integer types.
This makes it crash

1000000.times{|i| puts "hello #{i}"}

couple of tips:

jquery's $() is aliased to j() in ruby. Try:

j('body').css background: 'pink'

window is alias to w(). E.g.:

w.alert('hello from ruby')

puts w.prompt('saywhat?')