3 ms·
Two out of three replies were talking about the assignment even mutation is the (obvious!) real issue. > OK, how about > x <- x + 1; Better. From such synta
by still_grokking 3y ago
Two out of three replies were talking about the assignment even mutation is the (obvious!) real issue.
> OK, how about
> x <- x + 1;
Better.
From such syntax you can at least guess that mutation is happening there.
Still nothing you would show a newcomer in a FP-programming introduction.
(I'm not sure why your comment got down-voted. I can only up-vote it, so I did; to battle stupid down-votes because "feels"…)
- _a_a_a_ 3y agoI think this reply needs a longer answer than I can give at the moment; it's morning here and I've got to work, I'll reply in a few hours hopefully with something constructive.
- _a_a_a_ 3y ago> x = x + 1; Your complaint is that the '=' is used in a different domain than programming with a different use. Rightly or wrongly people will adjust to different notations very easily, homonyms in natural languages rarely cause problems because of the context. Same here, this is C/C++ not formal logic. Once somebody is told 'this is mutation' and it sinks in, it's not a problem. You make the bigger claim that FP is easier to understand, and I don't buy it. If you want to put forward that, back it up with some evidence. Personally I believe that it depends on the person. I did a brief introduction to FP to a couple of mathematicians and they got it immediately, but then they were extremely bright and had minds naturally suited to handling abstractions. (edit: which I am not and have not, respectively) And one of them was not allergic to learning C either, and he got a few lessons in that too. I worked with one person who simply couldn't understand the concept of passing a function around like any other piece of data. It frustrates me when people (like you) insist that one programming paradigms is The Truth because, the truth is, you need all of them and you need to apply them at the right time – 00, FP, logic, and yes, procedural. If you can't do that, if you're too hung up on one-way then it speaks of inexperience. As a programmer you're there to deliver a solution, not a technology, and I've been involved in the mess when someone far too inexperienced pushed for the tech rather than the saleable product. Final note, the inventor of Scala is Martin Odersky and I was watching one of his videos on YouTube where he very much surprised me by saying something about allowing Scala to be imperative for when imperative solutions were the more concise answer. And in the end, all computers are state machines. So please, loosen up your presumptions; the world is a messy place and you need to allow for that.