4 ms·
"I'm both a Lisp and a C++ fan..." I find that to be very interesting. I spent far too many years working with C++, trying to master all of its nooks and cran
by nocman 16y ago
"I'm both a Lisp and a C++ fan..."
I find that to be very interesting. I spent far too many years working with C++, trying to master all of its nooks and crannies. It was my frustration with the limits of the language that drove me to finally learn Lisp. The fact that for loops always ended up appearing clearer than using STL was extremely frustrating. I'm not 100% sure that the introduction of lambdas in the newer versions of the C++ standard will not fix the problem (or at least help some), but I sincerely doubt that they will be enough. I truly wanted to use STL and the the standard containers, but it always ended up feeling like I was working extra hard to try and "get it right". In the end it was faster just to grumble, write another for loop with an explicit iterator, and move on.
And yes, I'm aware of Boost and the like. I have all the template metaprogramming books you are likely to name. It all still feels terribly unnatural and forced compared to, say, composing a chain of function calls against a list of data in Lisp or Scheme.
- shin_lao 16y agoI really like playing with Racket. It's very powerful and simple. Mathematical. I concede that. But it's not "natural". I can guarantee you that Lisp showed to a novice isn't "natural". C++ is different. It's not unnatural. There's no "natural" programming language. C++ is explicit. You need to manage your memory. You need to tell how the return value will be handled. You need to work with the compiler, the linker. You have more control. More power. It gets in the way for some tasks, but it is mandatory for others. I find the lack of STL to be frustrating, because I'm used to it. To me it feels "natural". There's no problem with not being proficient with C++ or the STL. It's just not your thing!
- ohyes 16y ago>But it's not "natural". I can guarantee you that Lisp showed to a novice isn't "natural". How do you define a language as "natural"? I can't say I find any language to be 'natural', there are just some that I know the rules to more implicitly than others. (Including natural languages like English or Spanish).
- nocman 16y agoJust to be clear, I didn't describe Lisp as "natural", I described using the STL (meaning, particularly, heavy use of STL algorithms, function objects, etc) as feeling terribly unnatural and forced. Judging by the reaction here, "unnatural" was perhaps not the best choice of words. What I meant was this: when trying to use the STL to get stuff done, I felt like I was always jumping through hoops to do things "the STL way", with the end result being more complicated and less clear than just doing it in a "C++ without the STL" way. > I can guarantee you that Lisp showed to a novice isn't "natural". Again, I never argued that Lisp was "natural". And secondly, if you are dealing with a true novice (as in, someone who has never programmed in any programming language), both C++ and Lisp are going to look decidedly "unnatural" to them. But I don't want to beat the natural/unnatural language dead horse any longer, since that was not what I was discussing. However, I will concede that Lisp looks decidedly foreign to people who have programmed before in languages with an Algol-like syntax (C, C++, Java, Javascript, Perl, etc). And, for the record, I am very proficient in C++ (many years of work experience), and I understand how the STL works very well (I invested a lot of time in learning the STL). I invested that time because I wanted to make C++ do more than it had done for me in the past, and the STL seemed like the way to do that. However, in the end I decided that there really was no good way to make C++ do what I wanted, and the real answer was to go with something that was far better at handling higher level constructs. After trying out Lisp (and Scheme) for I while I realized that the primary things I was trying to do with the STL were no-brainers in Lisp. And with a decent FFI I can still use C or C++ when I need to do things at a lower level. I still use C++ libraries when it makes sense to do so, but I would not now start a new project with C++ as the primary language if given the choice to use something else (unless, of course, the only choices were something even worse than C++ :-D ).
- joe_the_user 16y agoI actually enjoy programming with C++ and Qt containers. Both STL and Boost seem like pathologically complex ways to do something that's already hard. Consider; in a situation where you're doomed to sometimes use a for-loop, where for-loops are pretty much the underlying semantics, using some proportion of higher level methods like filter when they don't shorten your code, turns these construction into obfuscating, leaky abstractions. But perhaps you have to actually be a C++ fan to use STL and Boost. I only view C++ as the least-bad-for-my-purpose language.