Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Honestly, this looks more readable than Python. Noticing whether something is 3 or 4 levels less indented than something else is really really hard. Noticing whether there are 3 or 4 braces is easy.


Why not use your editor to do this? I would never expend mental energy doing something this trivial in 2024.



Use my editor to do .. what exactly?


Use what are often called "indentation guides". Here's an extreme form of them from the blockman extension for vscode: https://raw.githubusercontent.com/leodevbro/vscode-blockman/...


1) that looks incredibly cluttered (yes, even compared to braces), and 2) it doesn't help a whole lot when reading code in any context what so ever which is outside of my preferred editor (including in github/gitlab merge requests or 'git diff' locally)


For me, what is visual clutter is all about what I'm used to. After a short period of adaptation, I found indentation guides disappeared when I was looking for them. You can also choose your styling. As I mentioned above, that was an extreme example. Here's a style that adds very little clutter (mine look a lot like this): https://i.sstatic.net/nxPrP.png

Also in the spirit of modern tooling, VSCode has had the ability to navigate GitHub Pull Requests, with all the normal code editing tooling, since 2018. I'd be surprised if it's alone in that ability in 2024. The same is possible with Gitlab Merge Requests using Gitlab's own extension. I can also use VSCode to remotely edit on almost any Linux/Mac/Windows machine that I can ssh into, or inside Docker containers.


Unlike braces, indent guides don’t take up vertical space, so it’s much less cluttered.


Indentation guides have been a thing in editors for about thirty? years. Geany supports them for example. Turn them on and never mistake a level again.

I also turn on visible whitespace but make the color very subtle in the syntax highlighting section. Makes inconsistencies jump off the screen. Other little features like deleting trailing whitespace are your friend.


Oh I'll just call Microsoft and ask them to install an indentation guides plug-in to the GitHub merge request diff view, one sec


[flagged]


How do I enable that feature in the GitHub merge request diff view?


Ignoring the tone of the other poster, the point they are making is that there is no clear value for indentation markers in a (unified) diff view, which is based around lines being removed and added.

Similarly, you might not even see braces for the corresponding block, so the braces-vs-spaces is not really a win for "braces".

However, I am guessing you are mostly using side-by-side diff view (as opposed to unified diff view), which might have some value to indicate indentation change for a bigger chunk of the code. But again, if you are not seeing where the block starts or ends with braces in the diff block, why is whitespace in any way "worse"?


I just explained why that question is nonsensical. What do you hope to achieve by repeating it?


You said:

> Everything outside of notepad already supports it—that was the point, dumbass.

As a response to me pointing out that it's not supported in the GitHub diff view. That response is nonsensical unless you meant to say that it's supported in the GitHub diff view.


No one is using block markers or indentation guides in a diff view because that doesn’t make sense. The two+ views would conflict with each other, so vast majority of such tools don’t even try to understand blocks. (difftastic however, on the terminal tries.)

If a diff is particularly complex (it shouldn’t but assuming) you’ll need to look at the destination in full and confirm tests etc have passed.

Any non-theoretical issues you’d like to discuss?


Let me try again.

You said:

> Everything outside of notepad already supports it—that was the point, dumbass.

As a response to me pointing out that it's not supported in the GitHub diff view. That response is nonsensical unless you meant to say that it's supported in the GitHub diff view


It's clear that my original statement referred to editors of source code. You then moved the goal posts to "merge diff" views on a website.

Despite that, I explained this didn't make sense, diffs being line-based and not block-based and all that.

That's two fundamental problems with your line of argument. This is my last reply.


Let me try again.

You said:

> Everything outside of notepad already supports it—that was the point, dumbass.

As a response to me pointing out that it's not supported in the GitHub diff view. That response is nonsensical unless you meant to say that it's supported in the GitHub diff view


To reformat your code for you. Quick two strokes should do it. I use Jetbrains and it’s select all -> alt ctrl L I think. Massive timesaver. Anything a computer can do to help coders good IDEs can do in the blink of an eye.


How much Python have you ever written or reviewed? With only a bit of experience, I am sure you'd have no trouble doing that if the Python code is not using 2-space indentation.

It certainly becomes a problem if you are looking at a 100+ line method/function, but with Python being as expressive as it is, a 100+ line method/function is a problem unto itself.

Otherwise, I've never had any issues with it — even with languages other than Python, I mostly rely on white space and alignment to understand the block boundaries, only resorting to reviewing the braces carefully when something is amiss.


I hope you don't have to do that very often. Occasionally, sure, but a lot of functions that have an indentation drop of 3 or 4 levels would be better refactored.


I'll remember to tell that to everybody whose code I could ever have to read in the future but I don't think it'll have much effect, we're talking at thousands of people I'm guessing and I don't know most of them




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: