- JS objects to hold Ruby objects and give garbage collection;
- JS objects for the various look-up tables in Ruby;
- JS anonymous functions for Ruby method bodies and blocks.
Some special cases in Ruby can be assisted by JS structures:
Fixnums can be stored in JS
numbers with a hard-coded proxy object for method despatch.
- JS has
falsecan stand in for their Ruby equivalents.
However, some things won’t work exactly the same:
- JS strings are Unicode. I don’t intend to change this.
- There’s no exposed
object_idequivalent in JS, so there can’t be one here either.
- As JS is single-threaded, there won’t be any threads.
loadcannot be implemented in the same way.
There are plenty of other things that I haven’t thought of yet. Despite this, I think that it will be possible to run the majority of straightforward Ruby code. Rails will probably never run in the browser, though!