TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Mruby – Ruby in your browser

77 pointsby NatWalmost 12 years ago

10 comments

siong1987almost 12 years ago
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.<p>I am a big supporter of asm.js after reading John Resig's post on it(<a href="http://ejohn.org/blog/asmjs-javascript-compile-target/" rel="nofollow">http://ejohn.org/blog/asmjs-javascript-compile-target/</a>).
gunnalmost 12 years ago
Nice to see! Some things are working very well:<p><pre><code> &#62;&#62; class Fixnum; def even?; self%2==0; end; end; &#62;&#62; (1..100).to_a.select{|i| i.even? } </code></pre> But some basic things are broken:<p><pre><code> &#62;&#62; n = 5 =&#62; 5 &#62;&#62; n =&#62; RuntimeError: arena overflow error</code></pre>
评论 #5816602 未加载
choxialmost 12 years ago
Very cool. We wrote a post about different techniques to getting Ruby in the browser on our blog: <a href="http://blog.bloc.io/running-ruby-in-your-browser" rel="nofollow">http://blog.bloc.io/running-ruby-in-your-browser</a><p>Webruby (Mruby.js) was one of the options we considered but ultimately didn't use.
rtpgalmost 12 years ago
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.
edwinyzhalmost 12 years ago
Cool! When I read the title I immediately thought - it must be done via emscripten, and it turned out that I was right :)
MrBraalmost 12 years ago
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".
评论 #5809736 未加载
seivanalmost 12 years ago
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.
评论 #5809806 未加载
coderhsalmost 12 years ago
Multiplying two large Fixnum, gives a float value.
评论 #5812017 未加载
adrianlmmalmost 12 years ago
This makes it crash<p>1000000.times{|i| puts "hello #{i}"}
txrxalmost 12 years ago
couple of tips:<p>jquery's $() is aliased to j() in ruby. Try:<p>j('body').css background: 'pink'<p>window is alias to w(). E.g.:<p>w.alert('hello from ruby')<p>puts w.prompt('saywhat?')