Re:Crystal in Production: Diploid
by faitswulff on Saturday October 28, 2017 @10:13AM
(#15575189)
Is there an easy way to get interop working between crystal and ruby? It would be nice to be able to simply require a crystal module that calls out to a compiled binary in the middle of my Ruby code.
[ Parent
| on HN ]
Not at the moment. About a year ago I did a proof of concept that replaced ActiveSupport's Inflector module with a fully working Crystal version, which was then compiled as a native extension. Since then, language changes have broken the way that I had things hooked up, although it was suboptimal anyways.
There is another strategy using macros, which is much better. I wasn't familiar enough with macros when I first tried it, which is why it was a bit hacky.
Crystal's core team has plans for a DSL to do this, so there will surely be something nice in the future. It's definitely feasible, and the performance was decent.
If you're interested (just remember mine's broken with current Crystal), my work is https://github.com/phoffer/crystalized_ruby and a macro approach is demonstrated at https://github.com/spalladino/crystal-ruby_exts
Re:Crystal in Production: Diploid
by faitswulff on Saturday October 28, 2017 @10:03PM
(#15577660)
This is the full talk, I assume: https://archive.fosdem.org/2016/schedule/event/ruby_extensio...