News for hackers. Stuff that matters.
Re:Xz: Can you spot the single character that disabled Linux... by secstate on Saturday March 30, 2024 @11:49AM (#39875988)
Mixing tabs and spaces usually throws a runtime exception. I'm not gonna make a value judgement about that, but your story doesn't make sense based on how I understand py3

Edit, sorry, shoulda read your whole commebt before replying

Re:Xz: Can you spot the single character that disabled Linux... by capitainenemo on Saturday March 30, 2024 @12:03PM (#39876104)
Yep. It was a few years ago while that was stilled allowed (as I'd noted ;) ) but regardless. Significant whitespace is just annoying.. There's a lot of things that render as whitespace, and source code one might be reviewing could be printed wrapped or copied and pasted in odd ways. Other languages are more robust to this.
Re:Xz: Can you spot the single character that disabled Linux... by _visgean on Saturday March 30, 2024 @07:24PM (#39879634)
Never had this happen, this is largely eliminated by using tools like black or other autoformatters.
Re:Xz: Can you spot the single character that disabled Linux... by eru on Saturday March 30, 2024 @10:18PM (#39880743)
And/or linters.

This issue is no worse that having multiple different variables that look the same and only in their obscure same-looking unicode symbols.

A linter can handle this. As can a decent font, or editor settings.

Re:Xz: Can you spot the single character that disabled Linux... by MrDresden on Sunday March 31, 2024 @03:52AM (#39882312)
The point still stands that this is an inherit possibility in the language it self.
Re:Xz: Can you spot the single character that disabled Linux... by eru on Sunday March 31, 2024 @04:15AM (#39882425)
Well, in C the visual indentation and the meaning of the code (given by {}) can diverge. That's even worse, and happens in practice. Many style guidelines for C have evolved specifically to address that problem with 'the language itself'.
Re:Xz: Can you spot the single character that disabled Linux... by worik on Sunday March 31, 2024 @04:35PM (#39887842)
> Well, in C the visual indentation and the meaning of the code (given by {}) can diverge.

How?

Re:Xz: Can you spot the single character that disabled Linux... by eru on Sunday March 31, 2024 @08:29PM (#39889596)
The compiler doesn't check your indentation at all. (OK, not true, these days you get warnings for misleading indentation.) But here's an example of misleading indentation in C:

    if(some condition)
        do something; {
        do something else;
    }
    do another thing;
You can stretch 'some condition' out over multiple lines and have some more parents inside of it, to make it more confusing.

See also https://softwareengineering.stackexchange.com/a/16530

Re:Xz: Can you spot the single character that disabled Linux... by worik on Monday April 01, 2024 @07:57PM (#39900854)
I see.

Yes

I class that as a bug in the original C specification

Re:Xz: Can you spot the single character that disabled Linux... by eru on Monday April 01, 2024 @10:38PM (#39901857)
But you either make visual indentation significant, or you risk having a discrepancy between visual indentation and what the language sees.
Re:Xz: Can you spot the single character that disabled Linux... by worik on Monday April 01, 2024 @10:55PM (#39901938)
> But you either make visual indentation significant...

That would be Python. I do not like it, which does not mean it is bad, it is a matter of taste

The alternative is you say "blocks are delimited by {}"

`if(foo) bar` should be invalid

`if(foo){bar}` is OK by me. Worik's tick of approval

(Neither is valid C I think)

Re:Xz: Can you spot the single character that disabled Linux... by eru on Tuesday April 02, 2024 @04:03AM (#39903367)
> That would be Python.

Not necessarily. In practice, in C-as-actually-used people (should) set up linters and formatters, so that you can rely on indentation.

When programming, this means that you can behave as if both curly braces and indentation are significant, and you get an error when they are out-of-sync.

Re:Xz: Can you spot the single character that disabled Linux... by _visgean on Sunday March 31, 2024 @06:41AM (#39883071)
I think its more of an tooling issue. If your editor / diff viewer cant differentiate between different whitespaces get a better one. Also if you want to ensure some function isnt in local scope etc just test it.
Re:Xz: Can you spot the single character that disabled Linux... by probably_wrong on Sunday March 31, 2024 @08:14AM (#39883563)
I feel that the main point still stands, though. Saying that Python doesn't have a whitespace problem because you can send the code through a tool that detects whitespace-related problems still acknowledges the existence of said problem.
Re:Xz: Can you spot the single character that disabled Linux... by heavenlyblue on Saturday March 30, 2024 @10:14PM (#39880726)
You can enable showing whitespace characters in your editor, in PyCharm they are visualised perfectly well as to not distract from the non-whitespace.
Re:Xz: Can you spot the single character that disabled Linux... by deanishe on Sunday March 31, 2024 @10:29AM (#39884609)
> There's a lot of things that render as whitespace

Like what? As you note, mixing tabs and spaces is now an error.

I've never understood the objection to semantic whitespace. Complaining about having to indent code correctly strikes me as being akin to complaining about having to pee in the toilet instead of the bathtub.

Re:Xz: Can you spot the single character that disabled Linux... by capitainenemo on Sunday March 31, 2024 @03:15PM (#39887149)
there is a huge difference between having a coding standard (handled easily by a linter on commit in most languages) and making a particular whitespace indentation a critical language feature.

Bonus, if there's a good reason to change the linter format, you can do so. Rust handles this rather well I think.