5 ms·
Clojure: live repl into running code Scala: Clojure: Explore the problem you are facing with quick prototyping in the repl and see the blind spots, the unknow
by serpix 7y ago
Clojure: live repl into running code
Scala:
Clojure: Explore the problem you are facing with quick prototyping in the repl and see the blind spots, the unknowns, the shape of data received from flaky integrations. Mold and shape your functions as the problem becomes clearer.
Scala: Best it can do is write unit tests and the debugger to look at what exactly is happening, devise a bunch of classes to handle them, rinse repeat and of course wait hours for recompiles. Refactor when new unknowns surface and curse at the fucking compiler not knowing what type it should be inferring.
Clojure programmers are done before Scala has a test environment up.
- joneholland 7y agoScala also has a live repl.
- serpix 7y agoPlease provide link as I need one. Ammonite is not it though.
- bobbyi_settv 7y agoI use jupyter notebook for Scala. I like having the same repl software for multiple languages. The kernel I use (almond) is based on Ammonite, but I believe there are others out there.
- iLemming 7y agoPlease don't try to compare Clojure REPL (or any Lisp REPL) with jupyter notebooks or something similar. The latter are mere "interactive environments" compared to "real" Lisp REPL. You have to actually try Clojure REPL and see what makes it so special.
- serpix 7y agoThank you for the jupyter notebook tip though. As I do have a biggish Scala app to maintain any help with it is good. :) Thanks again.
- tensor 7y ago> Explore the problem you are facing with quick prototyping in the repl and see the blind spots, the unknowns, the shape of data received from flaky integrations. Mold and shape your functions as the problem becomes clearer. This is a great way to end up with undocumented code with no tests. The repl definitely encourages this process, but you should be doing this via quick running unit tests rather than the repl so that when you are done you already have a set of tests. Otherwise tests are an after thought and usually after thoughts are either not done or done poorly. edit: you can always run your unit tests via the repl too, if you'd rather not use a fast test runner.
- justinhj 7y agoI'm sure you're happy with Clojure and I'm not going to try and convince you Scala is better but you have some misconceptions. Firstly Scala does have a couple of REPL's, the best being Ammonite which is mentioned below. It can be embedded in code to provide a live repl just as your Clojure program. I often work in Scala in a similar way to I work in Clojure; creating and testing new types and functions in the repl before moving them back to a source file. The way you build programs sounds quite horrible, but I know people do it that way and it works well enough. Your complaints about long compile times are largely irrelevant. Incremental compilation means it's usually 2-3 seconds at the most before I can test a change. We don't build programs as a bunch of classes by the way, that would be OOP. Scala is more commonly written in a functional and/or streaming/reactive stle. Also I'm glad you brought up refactoring. It's a breeze in Scala because of the strong type system. Poorly defined data can be expressed just well in Scala with types as it can in your blob of maps of maps, and it's much easier to work with. Finally you may finish your program first; it appears to do the thing you want but you can't really be sure. There will be more runtime errors such as NPE's and type errors because you don't have mechanisms to remove them from possibility. I'd much rather maintain and evolve a Scala program.
- the2bears 7y ago> Scala is more commonly written in a functional and/or streaming/reactive stle. This is the exact opposite of my experience. All the Scala I've seen "in the wild" is basically Java with a slightly different syntax. All OO, with the odd high-level function thrown in to prove something I guess.