5 ms·
The clojure REPL is nice, don't get me wrong. But I think the reason people rely on it more than in other languages is because of clojure's slow startup time. I
by keithasaurus 6y ago
The clojure REPL is nice, don't get me wrong. But I think the reason people rely on it more than in other languages is because of clojure's slow startup time. If you could just make a change and run tests immediately, you'd see much less REPL abuse.
- Jtsummers 6y agoCommon Lisp is not terribly slow to start, and people rely on its REPL when programming in it. Even Python's REPL is quite popular, and it's not slow to start either. The REPL is relied on because it's useful for exploring parts of a system or program. It's like being able to both dissect and vivisect the system without having to go through all the normal issues of setting up a debugger and instrumentation. The environment and program is just there.
- 3pt14159 6y agoI never really did much REPL programming until I started using pdbpp with a bunch of aliases and customizations in pdbrc and pdbrc.py (the former does aliasing[0] the latter does setup before boot) it makes iterating with a test suite so much faster. [0] For example: alias cc import pdb; pdb.disable() alias ppr pp response.json()
- Fellshard 6y agoI'm not sure this is correct. The REPL 'phase' of feature development tends to be useful before you want to ossify things in tests; it's excellent for exploratory thinking, and it encourages you to build a small suite of tools and state to tinker with, whereas tests cut through to use the minimal required tools and state to formulate the completed, trimmed down thought.
- blain_the_train 6y agoThe repl is another tool. I can and do run my tests in the repl. I can set my tests to run everything I change a fill, now the repl has enhanced my tests. The reason the repl is widely used in clojure is because it's the fastest way to get feedback on ridge code. I draw a sightly superficial line between ridge and dynamic code. Ridge code would be like an API call to get very specific specific results, here the repl is better then a unit test, for it would be too much for code and time to capture your specific API call results, namely because you haven't really tested anything much larger than a couple data points. So, it's the opposite, unit tests are often used because languages lack a repl.
- LandR 6y agoI run with lein test-refresh on my clojure code, as soon as I change code in either my src folder or my test folder, the tests are run. It's instant. There's no waiting on the startup time here at all, sometimes its so fast I don't believe the tests have actually run (so I break something and change it back to confirm). It's a very very fast way of developing. You can see me breaking a test here and fixing it: https://www.youtube.com/watch?v=XKCZv9YD0KI https://www.youtube.com/watch?v=XKCZv9YD0KI The test runner is in the bottom horizontal pane.The tests run instantly.