3 ms·
Maybe I miss what REPL really is, but... If REPL is the main value proposition, how is it better from average JavaScript development? Dev tools allow you to b
by Byamarro 2y ago
Maybe I miss what REPL really is, but...
If REPL is the main value proposition, how is it better from average JavaScript development?
Dev tools allow you to basically interactively work with your code.
- cess11 2y agoYou can keep a JVM running in the background with your project loaded and send stuff there from your IDE/editor. I don't think this is possible with JavaScript.
- dmos62 2y agoYou can eval strings in Javascript, so pretty sure that's possible.
- cess11 2y agoLooking around I don't find any maintained projects for this purpose.
- stronglikedan 2y agoIt's just a native function named eval(), so I wouldn't expect to find projects built up around it.
- cess11 2y agoThat's not enough, there ought to be IDE/editor integration and so on. Here's one such project: https://github.com/swank-js/swank-js https://github.com/swank-js/swank-js
- throwup238 2y agoQuokka.js would probably be the nearest JS equivalent.
- deleted 2y ago[deleted]
- snarkyturtle 2y agoSo they try to make the least-worst JVM environment which is great if you're dead-set on using the JVM, which has a lot of pros. For most people Python/Javascript also does the job and you don't need to learn another paradigm — a Lisp — to code for it, which also makes sense. However, learning a Lisp also makes you a better coder because of immutability and less side-effects. Hence why Clojure is still around.
- diggan 2y ago> For most people Python/Javascript also does the job True, and people should use whatever works best for them/for the job, no questions asked. But they also have nowhere near the same experience even though they technically have REPLs. The way a JS/Python dev typically use a REPL is experiment in the REPL itself, then when happy, write the "real code", while a Clojure developers write "real code" all the code, sending selections of code to a REPL in the background, viewing the results in their editor, and just saves the file when they're happy. It might sound similar, but very different experience. > However, learning a Lisp also makes you a better coder because of immutability and less side-effects. Hence why Clojure is still around. I don't think "immutability" and "less side-effects" is something lisps in general/all lisps promote/facilitate, it's mostly a thing that Clojure (and children) sticks out for caring a lot about. Scheme/Common Lisp is about as immutable as JavaScript is, and lots of CL programs/code out there spreading mutation all over the place, while in Clojure it's pretty common to just have small "pieces" of mutation in somewhat centralized location.
- cess11 2y agoI think it's "around" because it's quite productive and sits on a rock-solid runtime with support for an astonishing amount of libraries. Around these parts it's common to have read and appreciated Paul Graham's old writings about becoming a better software developer through Lisp, and that would be Common Lisp, i.e. very mutable, commonly object oriented.
- cogman10 2y ago> learning a Lisp also makes you a better coder It can do, but it also can make you a worse coder. Specifically in typed languages. One of the issues I've ran into with Clojure devs doing Java is that instead of relying on a type, they tend to want to write stuff like `Map<String, Map<String, Object>>`. Even when the key sets in both maps are well known. This becomes worse when you mix that with Immutability. Immutability can be fine except when you need a mutation. In applications that require heavy mutation of data a `Map<String, Map<String, Object>>` is one of the worst ways to represent structured data, copying that structure is EXTREMELY expensive. This isn't to say that you shouldn't usually strongly prefer Immutability. But it's also to say you shouldn't underestimate the cost of allocations and copying data. Theres always tradeoffs. Part of being a good programmer is knowing when those tradeoffs are best applied.
- daslu 2y agoOne important detail is that in Lisps like Clojure, printed values can usually be read back as code. So, the REPL is really a read-eval-print-LOOP. Another detail is that the whole culture of the language, oriented towards immutable data, makes it very easy to evaluate almost any sub-expression in your code, which makes the whole code introspectable in a very playful and dynamic way.
- dionian 2y agoI never got deep into any lisp like language but this was one of my favorite aspects of them - homoiconicity.
- cutler 2y agoIt's totally different. The R in REPL retains its original reference to the Lisp READer which is special when your code is structured as an AST as in all Lisps. Only in Lisps can you select the left paren of a deeply nested function and hit Eval. Other language REPLs are really just shells by comparison.