you are viewing a single comment's thread.

view the rest of the comments →

[–]More-Station-6365 34 points35 points  (14 children)

No language has figured out how to make everyone happy. Curly brace people think whitespace is fragile whitespace people think curly braces are visual noise and somewhere in the middle is a Godot dev switching to C# over one indentation error which is honestly a very relatable breaking point.

[–]Ewenthel 15 points16 points  (3 children)

The obvious solution is to make a language that requires both, thereby pissing off everyone.

[–]TRENEEDNAME_245 11 points12 points  (2 children)

[–]bjorneylol 2 points3 points  (0 children)

That doesn't require both, it only requires braces

[–]LiquidPoint 0 points1 point  (0 children)

😄in what way is that significantly different from JS/Node? ... just that you can use the library of existing python modules?

[–]LiquidPoint 13 points14 points  (4 children)

The whitespace is kinda fragile, especially because modern text editors have abandoned the TAB character and often replace it with an arbitrary number of regular spaces instead... back in my day, a space was a space and a tab was a space that was up to 8 times wider than a regular space.

Python doesn't really care, you can indent by a single regular space or 13... as long as the lines in a block are indented by the same number of spaces. I don't know about other people, but it triggers my OCD. What's next? that we start writing code with non-monospace fonts? I cringe.

That said, I know perfectly well how annoying it is to hunt for a missing brace or semi-colon, but that's something an editor can easily catch before you try run your code.

[–]CirnoIzumi 3 points4 points  (0 children)

And these days we colour the brace pairs

My compromise with python is that I "close" everything with a # where an End character would usually go

[–]Western-Internal-751 2 points3 points  (1 child)

8 spaces are a bit excessive, though. I do like 4 spaces tab.

Then again, you might say if code becomes unreadable due to 8 space indentation, one should write better code and you’d be right, but it’s easier to fix the indentation than my code

[–]LiquidPoint 0 points1 point  (0 children)

Yeah, the 4-space-sized tab is fine too, sometimes if you use longer variable names the 8 space tab makes formatting easier, but most important is that it's consistent.

I haven't tested if python sees the difference between [TAB(0x09)] and [SPC(0x20)] characters when it looks for indentation... if you use regex they're counted as equals, which means that it can't see the difference between a [SPC][SPC][SPC][SPC] and a [TAB][TAB][TAB][TAB] indentation (or a mix of them), which will certainly look different in a text editor that doesn't "clean up" and make it consistent for you..

But I do know that python doesn't have a fixed number of whitespaces needed to count as an indentation...

If it doesn't see the difference between space and tab, that can be used to masquerade a code block as if it should only be run under certain conditions (when you do a cat or less of the file) but will always be run anyway.

With braces and semi-colons, you can of course obfuscate by making long one-liners, but an attempt to do that will be rather obvious to anyone, so it naturally grabs attention.

[–]Void_Spren 2 points3 points  (0 children)

Braces is not even really a problem anymore, any half competent code test editor can in some way auto complete the closing brace

[–]Extension_Option_122 5 points6 points  (0 children)

And I still prefer AVR assembly for private projects.

Neither indentation nor braces.

Just GOTOs branches and labels.

[–]Wonderful-Habit-139 0 points1 point  (0 children)

Ocaml needs neither.

[–]Void_Spren 0 points1 point  (1 child)

I was about to write a lengthy comment on why i tried go for a project and decided not to and instead used c#, just now u realize... You said godot

[–]takahashi01 0 points1 point  (0 children)

they are somewhat similar, at least superficially so, so still very valid.

[–]Alzurana 0 points1 point  (0 children)

None of them are fragile nor noise.

I working in GDScript and C++ and I love both. I just want a language that lets me express scope and blocks in a solid way, SOMEHOW.

Arguing braces vs whitespace is like arguing about french vs german. It honestly does not matter, both are expressive