3 ms·
> Cognitive load is important This, to me, is a very powerful statement that points to the major change between old C++ and the current model (which is IMO is
by ptero 8y ago
> Cognitive load is important
This, to me, is a very powerful statement that points to the major change between old C++ and the current model (which is IMO is a monster). It may have gained a lot in the process, but at a huge cost to conciseness and clarify of written code. And this may be fatal for a general purpose language.
Maybe as other languages with focus on cleanliness and clarity (Pythons, Kotlins and Haskells of this world) become fast and powerful enough for large projects the use case for simple and clear C++ code decreases. Then C++ can still provide benefit for, say, intermediate representations. But this complexity increase may be one of the last nails into its coffin as a general purpose language. My 2c.
- jstimpfle 8y ago> clarity [...] Haskell no. Just no. Haskell is a lot like C++.
- zozbot123 8y agoHaskell 98 is a hell of a lot cleaner than C++98!
- SomeHacker44 8y agoFor the case in point, Haskell is much clearer. You can do Pythagorean Triples in one line. Google it if you don't believe me. However, in general, (in my opinion of course) the cognitive load for Haskell is low as a novice, but gets higher and higher as you go down the rabbit hole toward learning, understanding and applying all of its power - which is constantly evolving not unlike C++.
- jandrese 8y agoJust because you can do it in one line doesn't mean that it has low cognitive load. In fact it probably increases the load since you have to think about all of the abstractions that are built into the language instead of reading them off of the screen. The three for loops version lays everything out right in front of your eyes.
- SomeHacker44 8y agoPerhaps you're right. On the other hand, list comprehensions are a core feature of Haskell, which does not have something akin to a "for loop," so it's something a novice would be familiar with as part of learning the core of the language, just as a C++ novice would learn about "for loops." So, I would argue the cognitive load is similar, and both lay everything out right in front of your eyes. Although, Haskell will do it with less syntax (alternatively, read that as "with more syntactic sugar").
- ptero 8y agoSorry, I was not trying to start a flame war. My point that there are now a bunch of languages (insert your favorite here) that used to be "OK for prototyping but not much more" because they were slow, promising but buggy or lacked some key features that now matured to offer a solid production choice.