News for hackers. Stuff that matters.
Re:Better Clojure formatting by kazinator on Friday December 07, 2018 @03:51AM (#18626077)
The thing is, code in the body of a function is rarely 80 columns long from the first non-whitespace character to the end of the line.

What would be useful would be a text editing mode that automatically scrolls horizontally to keep the code in view, regardless of indentation amount. Then you can have your 80 column window.

What sucks is moving down in a body of code, and watching the text disappear out to the right because the cursor is tracking straight down through the indentation instead of riding to the right of it.

Re:Better Clojure formatting by bunderbunder on Friday December 07, 2018 @07:47AM (#18627174)
That would do nothing to help the "I can't see all the code at once because it's bleeding off the side of the screen" problem. You'd just end up with getting to use a different set of keys, and slightly fewer keystrokes, to choose between not getting to see either the start of some lines or the end of some lines, which is a marginal improvement at best.

And I'm guessing it would only worsen the problem of sprawling code that's difficult to read, by removing one of the few sources of pain that encourages developers who are less mindful of what it's going to be like for the person who'll have to read this stuff 3 years down the road to exercise at least a little bit of care.

Re:Better Clojure formatting by kazinator on Friday December 07, 2018 @07:31PM (#18632948)
I can't see all the code at once because it's 80,000 lines and I have a 50 line peephole; so the "see all the code at once" has sailed. Roughly speaking, Lisp code grows diagonally:

   (.....
     (....
       (...
        (.........
             (..
               (...)
               (....)
                 (...(...
                       (.....)))
                 (   )))
               (............))))...)

If the 80x50 peephole moves nicely along the diagonal, I'm okay.

I don't want to go from this:

   +-----------+
   |(.....     | ;; not to scale, obviously
   |  (....    |
   |    (...)  |
   |     (.....|...
   +-----------+.
                (...)
                (....)
                  (...(...
                        (.....)))
                  (   )))
                (............))))...)
To this:

   (.....
     (....
       (...
        (.........
             (..
   +-----------+...)
   |           |....)
   |           | (...(...
   |           |       (.....)))
   |           | (   )))
   +-----------+............))))...)
When I move the cursor down. If the box would move diagonally, that would be great. Yes, of course the box will have empty space at the bottom left and top right.

That could be addressed in a funky way: why not rotate the text about 45 degrees? Then the rectangular window would capture a fuller slice of the diagonal. I could get used to the rotated text.

Re:Better Clojure formatting by bunderbunder on Saturday December 08, 2018 @02:07PM (#18636897)
We may be at a cultural impasse, here. I see code that's nested that deeply, and it just makes me want to close the editor and go find something else to do.

Whether it's single lines that make a beeline for the pure land in the east, or towering ziggurats of stacked contexts slowly plodding their way into the sky, it doesn't really matter all that much to me. I count both of them as "sprawling code that's difficult to read." Lisp's a functional language; it's totally acceptable to break things up with a `defun` (or I guess, in this case, `defn`) here and there.