CRuby vs MRuby FAQ

mruby, Ruby 2 Comments

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.

Tweet about this on TwitterShare on Google+Share on RedditShare on LinkedInBuffer this page

About Frank Celler

Frank is both entrepreneur and backend developer, developing mostly memory databases for two decades. He is the lead developer of ArangoDB and co-founder of triAGENS. Try to challenge Frank asking him questions on C, C++ and MRuby. Besides Frank organizes Cologne’s nosql group & nosql conferences.
  • Masahiro Nakagawa

    > It tries to follow ISO / IEC 30170.
    This is a mistake. I translated below.

    Even if ISO / IEC 30170 defines some classes and methods, MRuby does not guarantee to implement such features.

    • Frank Celler

       Thanks a lot. Sometimes Google translate is not that helpful to understand, what is said. Will correct.