verstra

joined 2 years ago
[–] [email protected] 4 points 2 years ago

I agree on basically all points. Great article, nicely explained.

[–] [email protected] 5 points 2 years ago (1 children)

Where is this meme from?

[–] [email protected] 3 points 2 years ago

He is a little confused, but he got the spirit

[–] [email protected] 1 points 2 years ago (1 children)

Yeah, that's true, auto formatters will always have cases which format weirdly and have a nicer alternative.

But in the end, the formatting does not matter much, so we all benefit for it being formated one way, and one way only.


How would you format on git server? Create commits automatically, or ammend commits on push?

[–] [email protected] 2 points 2 years ago (1 children)

It looks like Hack?

[–] [email protected] 0 points 2 years ago (3 children)

Well, I'm saying that we could design a language where code would have to be formatted, so it would not be up to the project leader, at least syntactically.

[–] [email protected] 5 points 2 years ago (6 children)

I strongly believe that code formatting does not hold any information and that because of it, compilers should reject non-normalized code, saying "run a formatter first". We have the tooling for most of the languages to make this absolutely painless, remove all head scratching of "what the hell is up with this code style" and just focus of the semantics. I believe that you should be allowed to produce code abominations like this code sample and have it auto-formatted into the code style that everyone can easily interpret.

[–] [email protected] 0 points 2 years ago (5 children)

People designing Python surly didn't think of this. And when they see this now, the reaction would probably be "this should not be in any codebase, ever". But it can be. It is valid Python.

And it's a consequence of pushing features like unpacking and array comprehension and slice assigning and f-strings without fully exploring how they will interfere. One could argue that Python would be better of without some of these features.

But I don't blame them - exploring all possible combinations of features is just too much. The number of combinations grows exponentially and even if you have a fuzzer generating all possible expressions, you don't have enough time in your life to review all of the combinations.

view more: ‹ prev next ›