News for hackers. Stuff that matters.
Re:Fancy Clojure REPL by capableweb on Thursday January 30, 2020 @01:35PM (#22193919)
What languages do you usually use? REPLs for languages like python and nodejs are never as integrated and well working as REPLs for lisp languages like Clojure. Probably the structure of the code that lisp almost forces you to have, makes the REPL experience much easier. Especially in Clojure where most functions are side-effect free which means you can run them out-of-context, as long as you've defined the vars it's using since before.
Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @02:35PM (#22194602)
Because non-homoiconic languages don't have "true" REPLs. At best they have "interactive environments". What's great about Lisp, and the point people complaining about parentheses miss, is that you can eval any [sub]expression without any preceding ceremony. That is not possible in almost any other language (maybe with exception of Smalltalk), simply due to the nature of the language syntax.

In Clojure, if you have something like:

(foo [a b] ((c a) b))

you can evaluate every single part of it, you'd get immediate feedback, what is `a`, what is `b` and `c`, the result of `(c a)`, the result of the entire thing, etc. Similar thing in JS would be something like:

let foo = (a, b) => { return c(a)(b); }

It's already more difficult to edit, there's no "structure", it's not easy to evaluate arbitrary pieces without "dancing around", introducing temp variables. Given Clojure code snippet is also data, it can be send over the wire, send directly to the connected REPL instance, etc.

That's what gives Lisp developers a substantial speed of development. When people talk about "what's good about Clojure", they usually say: immutable data-structures, stability, hosted nature - can target JVM, JS, BEAM and CLR, can even have interop with Python and R. But the coolest thing about Clojure and Lisps in general - they provide "true" REPLs.

Re:Fancy Clojure REPL by e12e on Thursday January 30, 2020 @06:02PM (#22196913)
Smalltalk isn't homoiconic?

You can certainly eval parts of a python or ruby program (although indentation-as-block needs some care in python).

In lisp you also need a useful scope (eg: if foo isn't bound "(foo 1 2)" won't be very useful).

Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @08:56PM (#22198273)
No, Smalltalk is not fully homoiconic, it has some nice "reflective" abilities, i.e. it's possible to view "code as data" that allows good REPL experience. But it's not a homoiconic language.
Re:Fancy Clojure REPL by capableweb on Thursday January 30, 2020 @02:41PM (#22194667)
Feels like we're talking past each other at this point. You're preaching to the choir here, and not sure where that came from. Basically the question was "What language do you use?" and now you're trying to tell me why lisps are great. I agree with everything you're saying, I write Clojure code professionally during the day-time, but your comment just came from nowhere.

Edit: or maybe you responded to the wrong comment?

Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @02:44PM (#22194697)
Well, we're not in a private chat. Other people may read it as well.
Re:Fancy Clojure REPL by capableweb on Thursday January 30, 2020 @02:46PM (#22194716)
Are you OK?
Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @02:58PM (#22194852)
Yes, I'm sorry for the confusion. You use Clojure, I use Clojure, we're both commenting in a Clojure related post. I know that I'm "preaching for the choir", and stating the obvious. But to many other people scrolling through the comments, all that may not be obvious.
Re:Fancy Clojure REPL by jibe on Thursday January 30, 2020 @06:53PM (#22197352)
Clojure community in a nutshell. Smart, but a little crusty.
Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @09:06PM (#22198328)
Please don't go that route. I've worked with several language ecosystems. Clojure community is one of the most open, acceptive, diverse and friendly communities out there. This thread is simply misunderstanding/misreading the intent of the commenters. It happens, nobody got hurt.
Re:Fancy Clojure REPL by finalfantasia on Thursday January 30, 2020 @01:59PM (#22194221)
I think what @iLemming meant is that she/he doesn’t understand the appeal of having a fancy REPL _UI_ (mostly virtual terminal emulator-based readline implementations) and working with it _directly_ as opposed to sending forms from your editor of choice to a REPL server.

I kind of hold the same opinion. Being more powerful, feature-rich, flexible than readline implementations, editors are, by design, more suited to editing forms. And, I believe, “sending forms from your editor to the REPL” is what the “REPL-driven development” encourages.

Re:Fancy Clojure REPL by capableweb on Thursday January 30, 2020 @02:39PM (#22194643)
Ilemming doesn't seem to care about the UI to the REPL. They simply don't care about REPLs at all. At least that's what I understand from:

> I almost never type directly in the REPL, even when I have it in my IDE

I agree that it's more comfortable to be able to send forms from your editor to be evaled somewhere else, I myself don't use the CLI REPL very much, but since I use vim-fireplace, I guess my REPL is in the terminal anyways.

Since it wasn't clear in https://news.ycombinator.com/item?id=22193862 what language iLemming uses or have experience with REPLs, I just wanted them to clarify.

Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @03:15PM (#22195040)
Sorry my bad, I should've probably clarified that I meant Lisp REPLs specifically.
Re:Fancy Clojure REPL by pjmlp on Thursday January 30, 2020 @02:06PM (#22194312)
Chrome dev tools are much closer to a Smalltalk developer experience than CLI repls.

As for Python, https://visualstudio.microsoft.com/vs/features/python/

Re:Fancy Clojure REPL by iLemming on Thursday January 30, 2020 @02:47PM (#22194739)
When you write Clojurescript, you don't need to use Chrome Dev Tools much. You can eval things in your IDE and the changes will be [almost immediately] reflected in the UI.
Re:Fancy Clojure REPL by pjmlp on Thursday January 30, 2020 @02:56PM (#22194836)
Sure, I was mentioning it related to JavaScript REPL experience, and having nice things like immediate visualization of data structures, debugging tooltips and such.

Naturally Clojure based IDEs like Cursive are also quite nice.