[Csnd] The Haskell vs. Python vs. other language inquiry
Date | 2009-04-03 19:40 |
From | Aaron Johnson |
Subject | [Csnd] The Haskell vs. Python vs. other language inquiry |
Hey all, For what it's worth, I use Python for nearly everything---it's easy to use and understand, it has tons of example code in the world, tons of libraries, it's easy to debug. I love Python so much, and it's done so much for me in music and for my productivity on a computer in general, that my little joke to myself is that C/C++ are great languages --- for designing a language one could actually _use_, like Python. Or for speedy libraries called from within Python. I can't see any reason to explore a more academic and little used language other than being purely interested in languages. At one point in my life I had the time for this, but no more---i just like getting things done, and that's why I'll stick with Python! Best, Aaron. |
Date | 2009-04-04 02:38 |
From | Erik de Castro Lopo |
Subject | [Csnd] Re: The Haskell vs. Python vs. other language inquiry |
Aaron Johnson wrote: > I can't see any reason to explore a more academic and little used language > other than being purely interested in languages. At one point in my life I > had the time for this, but no more---i just like getting things done, and > that's why I'll stick with Python! I suggest that you read up on the Blub Paradox [0]: http://c2.com/cgi/wiki?BlubParadox The reason to explore these langauges to to get the programmer productivity of Python (maybe even better), with a runtime speed approaching that of C and C++ and programming language features not available ouside Haskell/Ocaml and a few others. Knowing Python well and Haskell not so well, I am investing time in Haskell because I think that within 6 months I will be as productive in Haskell as I am in any other langauge I know, but that my Haskell code will run many times faster than Python and will result in more reliable programs than I could write in other languages. A couple of points to back this up. Firstly, these so called 'academic' langauges [1] like Haskell and Ocaml have a least one feature that Python/C/C++/Java/etc doesn't, variant types and pattern matching: http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types.html http://www.mega-nerd.com/erikd/Blog/CodeHacking/Ocaml/variant_types_code.html The variant types and pattern matching make coding some problems like computer algebra systems and compilers so much easier and less error prone than they would be in langauges without these features. Secondly, languages like Ocaml and Haskell have the ability to have the compiler prove that the code obeys certain properties. For instance a function to turn a list of Ints into a list of strings might have a function signature of: stringize_ints :: [Int] -> [String] This function signature specifies that the function has a single input parameter, a list of Ints and outputs a list of Strings. If the implemention of that function doesn't meet the specification then that is a comile time error. If you call that function with something other than a list of Ints, then thats a compile time error. While you may think you know this form langauges like C, C++ and Java, Ocaml and Haskell take the idea of compile time guarantees much further and is a less obtrusive way than C/C++/Java. While I agree this may not be important for code that you write for your own use, I believe it is important if you are writing code for other people to use. At work I write code in Bash, Python, C, C++, Ocaml and Haskell for embedded kiosk type devices. Of this code, only code written in C, C++, Ocaml and Haskell (apart from very small bash scripts) ever gets run on the the kiosk devices because these languages provide compile time guarantees of correctness of a larger subset of functionality than code written in Bash or Python. Similarly we are moving from C and C++ to Ocaml and Haskell because these later languages have greater guarantees of correctness than C and C++. Depending on these compile time guarantees is not by any means a subsitute for testing, but it does mean I don't have to test for errors the compiler can find. Finally, just because Python is the current hot language that everyone wants to use, it wasn't always that way. Before Python became really popular people were using Perl or Java and before that C++ and before that C and before that Algol or something. This history (and the Blub Paradox) suggests that while Python may be highly popular now it too will one day be superceded by something else. Having used C, C++, Java, Perl, Python, Ocaml and Haskell among others, I have a feeling that the next big language will be more like Haskell than any other langauge that is available now. My hope is that it is a langauge with dependant types, a feature missing from Haskell and Ocaml. Erik [0] I know there is some controversy over the Blub Paradox, that is why I linked to the C2 wiki instead of the original Paul Graham article. [1] The best known book about Haskell is called "Real World Haskell" http://www.realworldhaskell.org/ -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/ |