337
you are viewing a single comment's thread
view the rest of the comments
[-] NewPerspective@lemmy.world 24 points 1 year ago

If white space carries any function that the compiler/interpreter needs to know about like structure or scope, it's probably not a very good programming language.

[-] sajran@lemmy.ml 8 points 1 year ago

Genuine question: why? What makes, say a semicolon, so superior to the the newline or tab characters?

To be clear: I don't think whitespace as a part of syntax is an awesome idea which should be more popular. It's definitely a bit more error prone in some ways. It's not perfect. But it's okay.

I've written a lot of Python and I don't think I have ever seen a syntax error caused by incorrect whitespace. I'm not exaggerating. I regularly forget semicolons in other languages but I never type out incorrectly indented code. Maybe that's just me though...

[-] NBJack@reddthat.com 3 points 1 year ago

How much of that python is written in a shared codebase with multiple active contributors? When was the last time you refactored a module?

Tabs and spaces are invisible. Semicolons are not.

[-] sajran@lemmy.ml 1 points 1 year ago

A vast majority of the code in question is the code I've written for my work projects with multiple active contributors and refactoring is very common too. We all like to shit on Python for various reasons but no one in my environment ever complained about whitespace.

Like I said, I don't think whitespace is perfect as a part of syntax but I'm much more likely to forget a semicolon than a proper indentation and this applies to any language. I guess it's not universal tough, because you can often see code with messed up indentation on online forums etc. TBH this is just unthinkable to me, indentation is absolutely necessary for me to be able to read code and reason about it. When I'm thinking about blocks and scopes it's not because I counted semicolons and braces, it's 100% indentation.

load more comments (2 replies)
load more comments (12 replies)
this post was submitted on 01 Sep 2023
337 points (96.2% liked)

Programming

17314 readers
79 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 1 year ago
MODERATORS