5 ms·
This is awesome to see that it's possible. I've always wondered about the same sort of concept, but instead it would be trying to use Crystal to run the latest
by dchuk 3y ago
This is awesome to see that it's possible. I've always wondered about the same sort of concept, but instead it would be trying to use Crystal to run the latest Rails version. I lack the time/energy/knowledge to try it, but it would be interesting to see how close you could get to either power or port Rails to Crystal, and if it would even be worth it (in terms of speed and type safety, etc).
- helen___keller 3y agoMy understanding is that this tends to be difficult because certain really-dynamic-stuff that Ruby offers (effectively metaprogramming) are not supported by Crystal, but are heavily used by Rails. On the other hand, Amber offers a look of what a Crystal rewrite of Rails would look like
- yxhuvud 3y agoWell, you'd have to move a whole lot of code generation from load time to compile time, including the stuff based on db layout. So quite a bit of work.
- jrochkind1 3y agoI mean, by making some changes to Rails source code, it was possible to get a simple "hello world" to display. Presumably you'd run into more bugs if you tried to do more than that. Rails does have a test suite (hopefully Rails 1.0 had a decent one?) , I guess the interesting experiment would be how much code do you have to change to get Rails 1.0 test suite to pass on ruby 3.3. Safe to say quite a bit more than for the hello world to run!
- e12e 3y ago> it was possible to get a simple "hello world" to display. That's not really the whole story. It was possible to generate a hello world web application server. Would've been interesting to see if other generators, generated migrations, models, controllers, views and tests worked (scaffolding blog posts and comments).
- jrochkind1 3y agoTrue; the generator for a "hello world" works to generate a "hello world" app that works! It's definitely way less than full support for a real Rails app though!
- wmoxam 3y agoI've done that with Liquid (https://github.com/wmoxam/liquid-crystal https://github.com/wmoxam/liquid-crystal), and it's roughly 2X faster than Ruby 3.2 w/yjit
- zoky 3y agoAdmit it, you just did it because the name is perfect.