←back to thread

2024 points randlet | 3 comments | | HN request time: 0s | source
Show context
js2 ◴[] No.17516019[source]
Background ("PEP 572 and decision-making in Python"):

https://lwn.net/Articles/757713/

replies(2): >>17516132 #>>17516693 #
jcelerier ◴[] No.17516132[source]
> The problem with the C-style of assignments is that it leads to this classic error: if(x = 0) {...}

yeah, if you code on 20 years old compilers with no warnings. GCC 4.1 warns about this (with -Wall) and Clang 3.4 warns about this too, without any warning flag.

replies(4): >>17516174 #>>17516220 #>>17517715 #>>17518178 #
Waterluvian ◴[] No.17516174[source]
I think that having strong opinions on how others should be developing software is how communities become toxic like this.

"Shooting yourself in the foot is your fault for not using a linter that detects accidental misuse of assignment!"

replies(3): >>17516217 #>>17516742 #>>17516875 #
Dayshine ◴[] No.17516875{3}[source]
Linter?

You mean compiler right? The compiler should be warning for things like this, not relying on 3rd party tools.

So, yes, if you're using a custom compiler, you kinda are to blame for shooting yourself in the foot. Just use the official binaries!

replies(2): >>17517020 #>>17518135 #
1. KSteffensen ◴[] No.17518135{4}[source]
It's not that easy for the compiler to provide these warnings when the language is interpreted rather than compiled
replies(1): >>17519210 #
2. TooBrokeToBeg ◴[] No.17519210[source]
The compiler can do anything a linter can do. Multi-pass multithreaded compilers are not unheard of. eg While compiling to temporary storage, I do a linting in another thread. At the end, check for successes and move the artifacts into the output directory.
replies(1): >>17519893 #
3. TwelveNights ◴[] No.17519893[source]
What the poster means is that a compiler may not be as applicable to interpreted languages.