←back to thread

451 points birdculture | 1 comments | | HN request time: 0.212s | source
Show context
CobrastanJorji ◴[] No.43979684[source]
Regarding the first example, the longest() function, why couldn't the compiler figure it out itself? What is the design flaw?
replies(3): >>43979765 #>>43979986 #>>43980940 #
raincole ◴[] No.43979986[source]
It's a design choice.

To make a compiler automatically handle all of the cases like that, you will need to do an extensive static analysis, which would make compiling take forever.

replies(1): >>43980933 #
1. j16sdiz ◴[] No.43980933[source]
Would be nice if an IDE can autofix it.

Maybe autofix as we type, or autofix when it save the document / advance to next line.