News for hackers. Stuff that matters.
Re:Programming at the REPL (2018) by dgb23 on Friday July 10, 2020 @12:52PM (#23793498)
> The REPL is still something that I haven't quite mastered, but what I enjoy doing right now is working in files and using a REPL connection to evaluate expressions within the file.

For me that is the optimal way of doing things.

I want to restructure stuff, make multiple versions of functions, move them in and out of comment blocks or just leave code there for REPL use.

When I first saw someone writing Clojure like this on a video I was thinking: "This is the way I want to write code." I think this is the best of both worlds.

Re:Programming at the REPL (2018) by adamkl on Friday July 10, 2020 @01:09PM (#23793709)
> I want to restructure stuff, make multiple versions of functions, move them in and out of comment blocks or just leave code there for REPL use.

I think programming at the REPL requires a very different mindset from how a lot of us learned initially. The thought of leaving commented code in our codebase is one of those things we're told not to do, but there's a great snippet from one of Stuart Halloway's talks where he mentions "Rich Comments" (pun intended I think).

Rich is apparently known for leaving REPL code inside comment blocks specifically for testing purposes, and as a sort of transcript of the work that was done. [0]

Its a great approach, and one that I've adopted, but it seems wrong at first glance when taken out of the context of a REPL.

[0] https://github.com/clojure/clojure/blame/4ef4b1ed7a2e8bb0aaa...

Re:Programming at the REPL (2018) by xapata on Friday July 10, 2020 @01:34PM (#23794039)
I like the practice of leaving REPL examples in docstrings, especially if I can include Python's `doctest` in the test suite.
Re:Programming at the REPL (2018) by deleuze on Friday July 10, 2020 @01:36PM (#23794072)
Wow, this just blew my mind. I usually keep a bunch of ; commented out lines at the bottom of my file so I can still do M-x cider-eval-buffer when I load up for the first time, but this makes so much more sense without having to comment and comment things all the time.