I'm quite interested in the mruby project, but have had no luck in finding a summarization of the major omissions in mruby compared to other, more complete Ruby implementations (most importantly, MRI).
The README in the project says that mruby implements "part of" the ISO standard for Ruby, but doesn't go into detail about which features are omitted.
Does anyone know of a list of such omissions, or is anyone familiar enough with the implementation to summarize?
So I haven't read the source closely, but after having built mruby and run the interpreter a bit, I found that the following things were missing (by no means is this a complete list, nor do I know whether these are intentional omissions or just things that haven't been written yet):
eval
String#scan
(instance|module|class)_eval
with String
argumentsModule.constants
Regexp
Process
Bignum
IO
, File
, and Dir
Encoding
Thread
and Mutex
Marshal
If anyone has a more complete list, or knows the details as to whether these bits are just not yet implemented or are intentionally omitted, I'd still be curious to know.
An partial but up-to-date list of differences between Ruby MRI and MRuby can be found at https://github.com/mruby/mruby/blob/master/doc/limitations.md.
As of March 2020 these are the listed differences:
1/2
gives Float(0.5)
because mruby does not support Bignum.puts
results in different output.Kernel.raise
without arguments does not raise the current exception within a rescue clause.Array
does not support instance variablespublic
/private
/protected
) is supported.defined?
is missingKernel#binding
is not supported.def foo(a, b, **k)
) are parsed in a different way.def foo(a, (b,c), d=b)
is not valid).nil?
metho is ignored in conditional expressions.Have a look at the so called mrbgems (https://github.com/mruby/mruby/tree/master/mrbgems). Some of your missing features (i.e. RegExp, eval, File) are available as an additional GEM.
I just run the simple code clip with mruby and got a different result from MRI.
class Fixnum
def +(b)
self * b
end
end
puts 3+4
mruby outputs 7 while MRI outputs 12
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With