4 ms·
500K LOC in Python is what, 2.5M->5M in a statically typed language? At that size I would expect any project to require explicit convention and communication ma
by spenrose 15y ago
500K LOC in Python is what, 2.5M->5M in a statically typed language? At that size I would expect any project to require explicit convention and communication management, simply because no one person can hold the whole thing in their mind at a resolution that reveals the code's meaningful features.
- jimbokun 15y ago"500K LOC in Python is what, 2.5M->5M in a statically typed language?" Depends if the statically typed language is Java or Haskell.
- tikhonj 15y agoAnd it's probably 200k lines in Haskell, which is very statically typed :) (For reference, GHC--a very complicated compiler with clever optimizations, language extensions, multiple backends...etc--is something like 125k lines of Haskell.) I've spent a significant amount of time with Python, both at work and in my classes and yet my Haskell code is usually 2-3x shorter for very similar programs. I think it's also easier to read, but that's indubitably a matter of taste.
- attractivechaos 15y agoThat is interesting. According to the computer language benchmark games, Python programs always have fewer LOCs: http://shootout.alioth.debian.org/u64/benchmark.php?test=all&lang=ghc&lang2=python3 http://shootout.alioth.debian.org/u64/benchmark.php?test=all... I know most programs there are written in an unusual way, but that at least means something.
- tikhonj 15y agoThere are a couple of things to note about that particular comparison. First, Haskell--particularly on GHC--gives you a ton of options for speeding your code up, including unsafe* functions and pragmas. So the fastest code is going to use things like {-# INLINE #-} and unsafeAt as opposed to ! (the array index operator). However, you would only use these things in performance critical bits of your code. Secondly, the length of the identifier (! vs unsafeAt) actually matters because the benchmarks do not measure the number of lines--they measure the compressed size of the code. [1] [1]: http://shootout.alioth.debian.org/help.php#gzbytes http://shootout.alioth.debian.org/help.php#gzbytes Finally, these are all small algorithmic problems. The goal is to write the fastest code possible, not something readable or maintainable. Some of the biggest reductions in Haskell come from generalizing and reusing functions in different contexts; I expect this does not happen in the benchmarks because of limited size and the focus on performance.
- spenrose 15y agoCompilers are programs for working with type systems. It's not surprising that a language that is all about working with type systems expresses them concisely.