3 ms·
PHP C and C++ are popular because they are imperative languages. For non mathematicians , "imperativism" is far more easier to grasp than functional , closures
by camus 14y ago
PHP C and C++ are popular because they are imperative languages.
For non mathematicians , "imperativism" is far more easier to grasp than functional , closures , first order, monads , ...
it is easy to understand what a IF statement does , what a FOR loop is , and a basic PROCEDURE or FUNCTION is.
It is not easy at all to think in terms of pure functions , immutability , etc ... because you need to actually design you code before writting it.
I dont think Haskell is hard because of the syntax , it is hard because it is a functional language.
- pcwalton 14y agoNone of the languages I listed feature purity, immutability, or monads. (Granted, Scheme and Standard ML do express a clear preference for immutability, but you can mutate all you want.) And closures are hardly an uncommon feature at this point, I'd say. Even C++ and PHP have them.
- tikhonj 14y agoYou say that, but it doesn't match my experience at all. I've taught high-schoolers basic Java and they had all sorts of problems with for-loops and procedures. In fact, it took me a while just to describe what a (mutable) variable was! To many of them, the idea of changing value was not intuitive at all. It didn't help that Java coopted well-known syntax from high-school algebra like x = 10 to mean something completely different. At my university, everyone started with a Scheme course followed by a Java course. The Scheme course starts out functionally, but never mentions it. People didn't have too many problems there except with recursion, and most of them got that after a couple of lessons. The Java course? Not so easy! People did have problems with if statements (why is it a statement and not an expression?). They also had problems with figuring out what was a reference in Java and what was passed by value. A lot of problems with that particular facet, in fact. In fact, the people without any programming experience before college had more problems with Java than with Scheme, despite the fact that the Java course was second. Basically, you're projecting your years of experience with imperative programming onto what you imagine a beginner thinks like. I do not think this is particularly accurate--it certainly doesn't match what I've seen in practice. For people with literally no programming experience, functional programming is not less natural at all. If anything, it makes more sense, because it fits with the minimal mathematical background everyone has.
- camus 14y agoI began programming with Caml. I found TurboPascal much easier to use. So definetly began with functional programming.