4 ms·
Artichoke Ruby Architecture
- no_wizard 6y agoThis looks really neat for the ruby community. It being modular I imagine the target is for Embedding when you know you only need X features of ruby so you get smaller and hopefully more performing builds? At least if I understand this correctly. As an aside: is ruby easier to implement than other languages? It’s syntax and features seems more complex than say Python but I’ve heard from others that implementing a new Python distribution in say Rust is a real PITA
- xutopia 6y agoI believe it is actually much harder to implement than many other languages because the syntax is so complex. You have so many edge cases to account for that it is rather difficult to consider all scenarios.
- danielheath 6y agoParsing is hard, but that’s only a small part of writing an interpreter.
- p4lindromica 6y agoFor now Artichoke leans on mruby’s parser, but I’m looking forward to using https://github.com/lib-ruby-parser/lib-ruby-parser https://github.com/lib-ruby-parser/lib-ruby-parser which is a Rust port of MRI’s parse.y.
- p4lindromica 6y agoCode size in an embedded context is one use case for the modularity here. Another is limiting access of Ruby code to the host system. For example, one may wish to use Artichoke in a game engine for scene scripting. It’s probably undesirable for Ruby code run in this context to modify the host environment, so `ENV` can be disabled at compile time. But maybe you have existing code that uses `ENV`. Toggle a compile time flag and you can get a compatible `ENV` implementation that is backed by a hash map.
- throwawaygimp 6y agoI hope so. I would love to use Ruby embedded one day
- semiquaver 6y agomruby is embeddable today.
- throwawaygimp 6y agothanks, didn't know about that
- pansa2 6y agoRuby’s syntax is definitely more complex than Python’s (which until recently was LL(1)), but it wouldn’t surprise me if Ruby as a whole was a simpler language. For example, Ruby’s object model is much simpler and more elegant than Python’s.
- hashmal 6y agoRuby is hell to implement. To quote Matz: > Ruby is simple in appearance, but is very complex inside, just like our human body
- lloeki 6y agoOne can already embed Ruby in any C-compatible project with mruby, which this project uses as a default backend. mruby itself is extremely modular. I’m not too sure this is for embedding related to size, but more as an abstraction layer to have the ability to switch backend, as well as embedding (as in inside a larger app, not as on embedded-class devices) but aimed at Rust projects. I find the description a bit misleading: > Artichoke is a Ruby implementation written in Rust and Ruby The arch doc seems to indicate this is an implementation in C and Ruby (mruby) with a frontend/backend layer written in Rust, and packaged as crates for ease of use in Rust. Maybe the desc is about the endgame, gradually eating the C part with Rust?
- dragonwriter 6y ago> It being modular I imagine the target is for Embedding That may be a motivating use case, but it also seems to serve their desire to manage complexity of implementing Ruby by using the strangler pattern and working up from mruby-based to MRI-based to full-Ruby-in-pure-Rust. > As an aside: is ruby easier to implement than other languages? From everything I've seen and heard, both from Marx and alternative Ruby implementations, no.
- nextaccountic 6y agoWhat's the tool used to make this diagram?
- p4lindromica 6y agoWhimsical - https://whimsical.com/ https://whimsical.com/