I’ve toyed around with Ractors, thinking they might be a Godsend for GUI apps, like those built by Glimmer DSL for LibUI (
https://github.com/AndyObtiva/glimmer-dsl-libui). But, they always turned out to be more pain to use with the variable access restrictions than plain old threads, which I get for free as truly parallel in JRuby while using Glimmer DSL for SWT (
https://github.com/AndyObtiva/glimmer-dsl-swt).
I don’t know. Maybe one day I’ll see the light of Ractors and change my mind, but being a long time multithreading user, I always thought the fears of using true multithreading were overblown in Ruby to the point of impracticality. In actuality, I use multithreading all the time when building desktop apps, and I never have issues with deadlocks given I correctly use mutexes/semaphores, or given that many apps don’t even need to share data through the threads, but could benefit from threads for parallel processing. It would be nice to have the more convenient option of multithreading for those cases at least.
I’ve always thought Ruby’s stance on multithreading was extreme. why not support it behind a non-default switch, and let those who don’t fear using them and know how to benefit from them safely use real multithreading by passing a switch, instead of getting forced to use something very restrictive and inconvenient like Ractors.
But, if it were my decision, I’d even make multithreading always enabled in Ruby. I’ve built countless desktop GUI apps with JRuby’s multithreading support over the years, and never had any issues. Check out this Mandelbrot Fractal renderer that takes advantage of all your CPU cores!
I’ve observed that most people who have issues with multithreading don’t really have a solid foundation of parallel concurrent programming from a university degree (I have a BSc in CS), reading books, or real experience, and thus misunderstand how to build multithreaded apps, thus run into the problems they claim are horrifying to the point of discouraging multithreading.