166
(page 2) 50 comments
sorted by: hot top controversial new old
[-] redempt@lemmy.world 6 points 1 year ago

why don't we store code unformatted and have everybody's IDE display it with their preferred format applied? it would make everything easier and stop people bickering over pointless things.

load more comments (5 replies)
[-] potterman28wxcv@beehaw.org 6 points 1 year ago* (last edited 1 year ago)

Interesting take. I prefer spaces because each piece of code that I see with tabs has an implicit tabsize you really need to have if you don't want the code to look ugly - especially if the person has been mixing tabs and spaces - and they usually do. Sometimes unadvertently.

When you remove all tabs at least everyone is on the same page.

To the actual problem raised by the article:

I have ADHD. Two spaces per indent makes it damn near impossible for me to scan code. My brain gets too distracted by the visual noise. Someone who’s visually impaired might bump their font size up really large, and need to scale up or down the amount of space per indent. Someone might just prefer it because…

I wonder if it could be possible to adjust the "indent number of spaces you see" in code editors. Code editors are able to figure out what are indents and what are not, so in theory it should be possible. Perhaps that would be an idea for a new feature?

load more comments (3 replies)
[-] skulbuny@sh.itjust.works 6 points 1 year ago

laughs in lisp

Nah, I'll keep on sticking with spaces or whatever the language's formatter uses. Ain't no way am I mixing tabs and spaces, will just stick with spaces.

load more comments (3 replies)
[-] Vince@feddit.de 5 points 1 year ago* (last edited 1 year ago)

I thought it was a non-issue that tooling should take care of anyway until stackoverflow published this:

https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/

Spaces all the way

load more comments (1 replies)
[-] 30p87@feddit.de 5 points 1 year ago

Ah yes I understand now!

[-] TheCee@programming.dev 3 points 1 year ago* (last edited 1 year ago)

Original poster is right by all accounts, of course. Now, let's come up with exotic significant indentations.

function xyz(a, b):
|   var x = 2

|   if true:
|   |   do_something()
|   else:
|   |   do_something_else()

|   anyway()

Pro: Your editor no longer needs to implement indentation hints.

Con: Looks obstructive if not highlighted like an indentation hint.

Your turn.

load more comments (2 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 05 Sep 2023
166 points (79.6% liked)

Programming

17686 readers
89 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS