[HN Gopher] Mruby/C and picoruby: high level langs in low-level ...
       ___________________________________________________________________
        
       Mruby/C and picoruby: high level langs in low-level devices?
        
       Author : rahil627
       Score  : 46 points
       Date   : 2025-03-23 09:20 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | rahil627 wrote:
       | some people hate to use C. Some people embrace it, even love it
       | (including many game devs!). You have full control! But i wonder,
       | what do HN folks think about these pico implementations of ruby,
       | a complex language made for the tiniest devices, such as sensors?
       | I mean.. is C really that bad??
       | 
       | also, it's very cool they're still being maintained!
        
         | pjmlp wrote:
         | It is a return to the age when we had BASIC and Z80/6502
         | Assembly, and yes doing memcpy/strcpy all over the place
         | instead of having proper arrays and strings is that bad.
         | 
         | At very least, C++.
         | 
         | "C++14 For The Commodore 64"
         | 
         | https://www.youtube.com/watch?v=nLv_INgaLq8
        
         | knowitnone wrote:
         | Then you should use assembly. I mean..is assembly really that
         | bad?
        
         | nine_k wrote:
         | Make a few small mistakes, even typos, and C becomes really
         | that bad, because you have full control, no restraints, few
         | guard rails.
         | 
         | C trades very fast execution for rather slow development,
         | especially of larger code bases, if you want correctness. It's
         | fine for tiny programs though.
         | 
         | (Ruby, of course, has its own set of jolly footguns, as any
         | dynamically typed language.)
        
       | jononor wrote:
       | Will have to look closer at picoruby. I do love MicroPython
       | development. One support thing is how easy it is to combine with
       | C, because to get the most out of microcontroller devices one
       | really needs to use low-level languages from time to time.
        
       | bsder wrote:
       | 256KB ROM/128KB RAM isn't very small.
       | 
       | That is larger than the average computer through about 1990 ...
       | 
       | (I know people will say I'm being pedantic. However, RAM and
       | Flash define most of the price of a microcontroller. So, a factor
       | of two--especially in RAM--means a significantly smaller and
       | cheaper chip.)
        
         | connicpu wrote:
         | Depends on use case for sure, though I'm not sure why you'd
         | want an interpreted language on a microcontroller unless you
         | had plans to be able to execute dynamically loaded code in the
         | field, which probably means it has some kind of network
         | connection, and 256KB ROM/128KB RAM isn't too big for your
         | Espressif chips and such.
        
         | tecleandor wrote:
         | Yeah, but 1990 was 35 years ago and Ruby even didn't exist. And
         | the average computer was quite bigger than a RP2040, and
         | consumed much more power :)
         | 
         | I mean, it's very difficult to compare those things. It's a
         | high level language runtime weighting a very small fraction of
         | the JavaScript we're loading on any silly webpage, and we can
         | run in on an stamp sized microcontroller that costs a couple
         | dollars and you'd typically need to program using a relatively
         | low level language.
         | 
         | I think it's neat.
         | 
         | Edit: I was trying to remember our computer then. I think we
         | already had an Amstrad PC1512 with 512KB of RAM by '87 or '88,
         | and by 1990 the 286s with 1 or 2MB of RAM were already common.
        
       | xutopia wrote:
       | You can look at the documentation on their web site too:
       | https://picoruby.github.io
        
       | TkTech wrote:
       | If this kind of stuff interests you, you may also like
       | micropython[1], which is currently overwhelmingly dominate in
       | this niche.
       | 
       | 1: https://github.com/micropython/micropython
        
       | aidog wrote:
       | picoruby is a lot of fun. It's a reimplementation of mruby/c
       | which is even smaller. You might be interested in my friend and
       | creator HASUMI Hitoshi's presentation. He shows off his Ruby REPL
       | that runs on the Raspberry Pi pico. Recently he ported picoruby
       | to other microcontrollers.
       | 
       | https://youtu.be/WxZNE5zTAjg?si=7DQUcQg80RMZoU0b
        
       | actionfromafar wrote:
       | Time to mention Shedskin Python to C++ compiler!
        
       ___________________________________________________________________
       (page generated 2025-03-24 23:00 UTC)