Re: Is mruby the future of Ruby language?

Marvin Gülker <[email protected]> Thu, 27 Jun 2019 21:58:08 +0200
Newsgroups gmane.comp.lang.ruby.general
Message-ID <20190627195808.f2ptif2xl6wvlex3@atlantis>
Am 27. Juni 2019 um 19:07 Uhr +0000 schrieb Jason Long:
> Thank you so much for your good information.You and your team using
> "mruby" because it is lightweight?

I think Carlo gave an excellent answer in
<[email protected]>, so I point you to that one.
Additionally, see below.

> Can Ruby embedded in other languages?

Assuming you mean the canonical Ruby implementation, MRI, then yes, it
is possible. MRI does have `libruby'. I have embedded an MRI into a C
programme before mruby even existed (I think that was back in the times
of Ruby 1.8.6). But embeddeding MRI is difficult and the resulting C API
is nowhere near convenient to use like mruby's API (again, take a look
at Carlo's post). Additionally, an embedded MRI has limitations that
mruby does not have. For instance, it is not possible to invoke two
instances of the Ruby interpreter simultaneously, because MRI uses
global state. mruby encapsulates all state information in a specific
object (mrb_state*), which allows to have as many Ruby interpreters
active as it is required.

There are disadvantages of mruby, though. mruby is "minimal" Ruby, as
the name says. If you need access to the RubyGems universe, then mruby
does not fit the bill. It does have MGEMs, but they're limited in scope
and are not going to make RubyOnRails available on mruby.

> I mean is that can Ruby offer the mruby features?

MRI and mruby are developed for different targets. On the one hand, MRI
provides the reference implementation of a general-purpose programming
language. On the other hand, mruby effectively targets Lua's market:
small and embedded, with a focus on pure Ruby as per the ISO standard.
Thus, mruby is lightweight and small, MRI is big and featureful.
Pick the right tool for the job.

Now, one could argue why we chose Ruby for our game at all. After all,
Lua has an established community in games. There is only one true answer
for this: bias. I'm the lead developer, and I'm a Rubyist. Ruby is
more cool than Lua! So we use Ruby and not Lua.

-- 
Blog: https://mg.guelker.eu

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>