+, automatic memory management ... Those weird things called "pointers" started popping up everywhere with their
*s (which would rarely mean anything other than multiplication in most other languages) and whenever I wanted to create a
new thing (be it a string, array or object), I had to explicitly calculate how many bytes I needed and call a library function just to get the memory allocated. And then there's suddenly a whole new class of possible bugs that wouldn't've even crossed my mind in the first place in other languages: segfaults, memory leaks, triggering undefined behavior ... the list was endless. I eventually got used to C programming but it probably took me at least half a year before writing C felt like using any other programming language.
As for Haskell, it was a totally different issue. Having just learned C and a whole host of other C-like languages, I got completely used to the imperative paradigm - declaring/initializing a few variables here and there, executing loops within loops, mutating and reassigning variables here and there, etc. And while I got a taste of functional programming using
reduce in JS or
Streams in Java (and of course C#'s handy LINQ queries), being forced to solve everything in a purely functional manner revealed just how little I really knew about functional programming. Suddenly, everything had to be solved using recursion one way or another (and that was the easy part!), and I kept hearing the term "monad" thrown around the rest of the time - if you ever wanted to print anything to STDOUT you had to use the
IO monad; you need to explicitly keep track of state using the
State monad; "error-handling" is usually done through the
Either monads ... (the list goes on and on) It's been more than half a year since I started learning Haskell and I've improved quite a lot since then, having used it to do a few parity proofs and explore advanced mathematical concepts such as isomorphism and the formulation of the natural numbers using Peano/Church/Scott encoding, but there's still content in A Gentle Introduction to Haskell that I just don't understand (yet), specifically the "tree parser" function demonstrated in this section of the tutorial.
So what about you? How many languages have you learned over the years? And were there any language(s) that particularly stood out to you as "difficult to learn"? Feel free to share your experience(s) in the comments :)