5 ms·
I don’t think this changes the inherent complexity of the code right? The basic logic of what is being done is still the same. De-indenting code but still havin
by bitexploder 8y ago
I don’t think this changes the inherent complexity of the code right? The basic logic of what is being done is still the same. De-indenting code but still having the same complexity, some of which is now abstracted by the language is still complexity. Maybe it somewhat helps the humans reading the code? But don’t you still have to reason about the basic state changes of the system the same way?
- dnautics 8y agothe code itself has the same complexity, but you are pushing the workload to the compiler, not to the human. Given the two options I typically prefer the compiler.
- AstralStorm 8y agoCompilers and libraries are written by humans and are probably the most fallible things ever, optimization wise. I'm not talking 1% here. I'd love to see an opposing compiler with an automated proof that it does what it claims. Well, unless your computer can read and parse high order proofs over code. Not even Haskell can do that. (It can barely parse F types much less optimize them.) The closest I have come to that feature is Isabelle's simplify and even that is limited. GCC and Clang can do basic bounds proofs at best and otherwise are tough buggy heuristic beasts. Just look at the trackers. GHC has a slightly easier job but it's paid for in programming complexity. There are hoops in type system you have to jump to get performant code... and even then the code generated its at best meh quality. There is always some joker telling that it could be compiled for SIMD or multithreaded but that never materialized in usable form.
- Touche 8y agoCompilers can only tell if programs are internally consistent, they can't help ensure that they are correct. Compilers don't know about inputs. Compilers don't know if the branch you wrote goes in the correct direction for a given input.
- mywittyname 8y agoWell, the compiler can optimize away any superfluous branches which exist entirely to act as hints for the programmer.
- arduanika 8y ago> they can't help ensure that they are correct Of course they can help. Maybe you meant: > they can't ensure that they are correct
- woah 8y agoIt prevents dumb mistakes like not covering all cases