4 ms·
This is pretty great, and provides the biggest thing I miss in Crystal's functionality compared to Ruby. (that is, a IRB-like REPL).
by renewedrebecca 4y ago
This is pretty great, and provides the biggest thing I miss in Crystal's functionality compared to Ruby. (that is, a IRB-like REPL).
- masukomi 4y agoit's had an IRB-like REPL for years. It just wasn't built into the language. Admittedly it was limited compared to IRB but it was more than enough to test out quick ideas. It's called ICR: Interactive Crystal https://github.com/crystal-community/icr https://github.com/crystal-community/icr the first release was back in 2017
- sam0x17 4y agoICR basically doesn't work the way you would expect it too. Every time you add a line, it re-runs all previous lines, making it quite hard to do REPL-like stuff when some of those lines do something external like DB commands, especially if they are destructive.
- masukomi 4y agomeh. I never put db commands in it. i just used it for testing out crystal code ideas. the rerun everything from the beginning wasn't really a problem.
- sam0x17 4y agoRight but one of the main benefits of a REPL productivity wise is being able to do stuff with your active record models in rails, so this was always a barrier in crystal.
- vegai_ 4y agoA REPL is definitely *not* allowed to silently rerun the previous commands in any circumstances.