Live data from Hacker News

mruby

github.com

31–40 of 59 posts

Re: mruby

#32
post #4

Could anyone explain to me what the difference with normal ruby is? "Lightweight", does that mean: Small but slow? Big but fast? Quite small and quite fast, but with a half-assed library? Big, slow, but low RAM usage? I understand from another comment that this is intended for embedded systems. Does that mean running it on a microcontroller without OS? Cause the moment you can flash Linux, you can use Ruby MRI, no?

>I understand from another comment that this is intended for embedded systems. Nope, he said embedding. He means things like Lua where you have a scripting language embedded in a program that is running on a faster lnaguage. Common in video game dev. >Does that mean running it on a microcontroller without OS? Nope, not necessarily. It being portable means it's plausible but it's an unlikely usage scenario. More likel…

Okok, I was wrong. Now, what's mruby for?

Re: mruby

#33
post #23

I've been waiting this for a long time. There's also TinyRB ( http://code.macournoyer.com/tinyrb/ ) but it's too small subset of ruby to be useful and seems abandoned. But my first impressions are not very positive (stripped x86_64 executables with -Os): -rwxr-xr-x 1 user group 708480 Apr 20 11:27 mrbc -rwxr-xr-x 1 user group 713056 Apr 20 11:27 mruby -rwxr-xr-x 1 user group 712128 Apr 20 11:27 mrubysample compared t…

Why aren't you a fan of lua? From what I've seen, it looks great.

Just a quick list of annoying things:

  - comments start with --
  - no bitwise operations in language
  - default numeric data type is floating-point. it's possible to change it to
    integer but it raises uncertainty with compatibility of external libraries
  - OOP in lua is quite programmer-specific: everyone seems to have their own
    best practises
Of course lua has good features too, like coroutines and good C API. Squirrel (http://squirrel-lang.org/) also seems like a nicer alternative to lua but it requires a C++ compiler.

IMHO lua's best asset is the small and fast VM. I wish there would be other good, modern languages that target it.

Re: mruby

#34
post #33

Earlier quoted context omitted.

Why aren't you a fan of lua? From what I've seen, it looks great.

Just a quick list of annoying things: - comments start with -- - no bitwise operations in language - default numeric data type is floating-point. it's possible to change it to integer but it raises uncertainty with compatibility of external libraries - OOP in lua is quite programmer-specific: everyone seems to have their own best practises Of course lua has good features too, like coroutines and good C API. Squirrel…

FYI: LuaJit comes with bitwise operations AFAIK. http://bitop.luajit.org/

Re: mruby

#35

Earlier quoted context omitted.

I thought the hivemind was that Lua was bloody awful? Disclaimer: I have never even read some Lua, honest question

It's not elegant but it's incredibly compact and isolated. I embedded it as a language in an iPhone game (as have many others). Making it bridge with Objective-C was fairly straight-forward and the memory/speed footprint was acceptable for a mobile device.

I find it elegant. It's like Javascript with the warts removed.

Re: mruby

#36
post #33

Earlier quoted context omitted.

Why aren't you a fan of lua? From what I've seen, it looks great.

Just a quick list of annoying things: - comments start with -- - no bitwise operations in language - default numeric data type is floating-point. it's possible to change it to integer but it raises uncertainty with compatibility of external libraries - OOP in lua is quite programmer-specific: everyone seems to have their own best practises Of course lua has good features too, like coroutines and good C API. Squirrel…

for the comments: that's a matter of taste, IMHO.

for bitwise ops: look at 5.2, it has it now. 32-bit operations.

floating point arithmetic: in practice, I haven't seen it as a problem as soon as I stay within the 32-bit range - then the numbers can be represented exactly, so the abstraction works well.

OOP: can't say for it, I did not do it much.

For the "fast" - check luajit (http://luajit.org/) - it is near-native speed while remaining reasonably slow.

And the FFI in luajit is simply fantastic. Take a look at https://github.com/justincormack/ljsyscall which binds the syscalls.

The annoyance that I'd thought of is that the array indexing starts with one, not zero - this brings some headaches during the index calculations. But this also forces to rethink the logic to use more of iterators, and abstract away from the indices. So, after all, it is not that big of a deal.

Re: mruby

#37
post #33

Earlier quoted context omitted.

Why aren't you a fan of lua? From what I've seen, it looks great.

Just a quick list of annoying things: - comments start with -- - no bitwise operations in language - default numeric data type is floating-point. it's possible to change it to integer but it raises uncertainty with compatibility of external libraries - OOP in lua is quite programmer-specific: everyone seems to have their own best practises Of course lua has good features too, like coroutines and good C API. Squirrel…

    -- Comment syntax is that a big deal?
    - bit wise: LuaJIT?
    - Just like in Python and Javascript, what's the issue?
      Doubles do just fine as integers if you code so that 
      you always wind up with other integers.
    - OOP - This I agree is a community fragmentation issue.

Re: mruby

#38
post #33

Earlier quoted context omitted.

Why aren't you a fan of lua? From what I've seen, it looks great.

Just a quick list of annoying things: - comments start with -- - no bitwise operations in language - default numeric data type is floating-point. it's possible to change it to integer but it raises uncertainty with compatibility of external libraries - OOP in lua is quite programmer-specific: everyone seems to have their own best practises Of course lua has good features too, like coroutines and good C API. Squirrel…

I see, thank you. None of this sounds like a show-stopper to me, but it's good to have a more complete view of a language I'm not intimately familiar with.

Re: mruby

#39
post #8

Matz talks about mruby here http://www.youtube.com/watch?v=OubzA8Q25jQ#t=1508s Here is more info on RiteVM http://www.reddit.com/r/ruby/comments/k9jce/ruby_ritevm_faq_...

Is RiteVM related? The reddit faq mentions both embedded systems and embedding via C API, I don't know which is the goal of that project. (sorry if that was covered in the talk, I'd rather not watch youtube right now)

Re: mruby

#40

Earlier quoted context omitted.

>I understand from another comment that this is intended for embedded systems. Nope, he said embedding. He means things like Lua where you have a scripting language embedded in a program that is running on a faster lnaguage. Common in video game dev. >Does that mean running it on a microcontroller without OS? Nope, not necessarily. It being portable means it's plausible but it's an unlikely usage scenario. More likel…

Okok, I was wrong. Now, what's mruby for?

Think of it as a replacement for Lua. Something you will be able to include as a scripting subsytem in most other languages.
Post reply on HN