At our last Ruby user group meeting it was asked, what the differences between CRuby and MRuby are. @junjis0203 wrote a MRuby FAQ. Unfortunately, it’s in Japanese. I’ve tried to translate it using & Google translate and added my own findings.

Not all classes and method from CRuby are available in MRuby

MRuby does not guarantee to implement the features which are defined in ISO / IEC 30170

Regular Expression

Mruby allows you to switch features on or off depending on your needs and available space. These features are defined in “include/mrbconf.h”. One of the features is regular expression support, which is switched off by default.

However, undefining DISABLE_REGEXP currently results in compilation errors (tested with 6d3b35e064ce46cc97530a4fc41e64e28c555c1a).

require is not working

MRuby does not implement a “require” function, see Matz’s comment.

$! is empty

When using “rescue” to catch an exception, the variable “$!” is nil.

The variable “$!” is not defined in ISO / IEC 30170. If you need to see the exception, use the “=>” syntax to assign it to a variable

Re-throwing an exception with “raise” does not work

Currently, re-throwing an exception within a “rescue” block with an “raise” without arguments is not supported.

No Big Number support

When an overflow occurs in the integer arithmetic, then MRuby will use floating point numbers instead. See Matz’s comment.

define_method and attr_reader are not implemented

These methods are now supported, see Matz’s comment.