Re:What are potential disadvantages of functional programming?
by eropple on Thursday July 27, 2017 @08:05PM
(#14870906)
Python (well, sort of) and C (despite its numerous other flaws) have a special syntax that doesn't read poorly, yes. The code you just described reads awfully. It's line noise. One of the most important aspects of a programming language is encouraging code that can be trivially read by someone who is familiar-but-not-reflexive with the language and does not necessarily understand the domain well enough to be managing both application state and syntactic state. If I have to think about what the code's syntax means, I'm not thinking about the problem.
And, frankly, the idea that you have to soft-pedal it as "you could do this" should be a red flag for you. I could meditate about a `loop` function or I could write the code I actually care about.
Re:What are potential disadvantages of functional programming?
by chowells on Thursday July 27, 2017 @09:30PM
(#14871213)
Are you sure you've got it the right way around? For-loops in C are syntactic garbage. "This is what I'm used to" is not the same as "this is good."
Re:What are potential disadvantages of functional programming?
by skybrian on Friday July 28, 2017 @09:46AM
(#14874216)
Why not? "What I'm used to" will tend to win in most usability studies. Weird and unfamiliar are harder to use.
Looking at how human languages work, it's hard to see how it could be otherwise. Your own language is always going to be easier to use than an unfamiliar one.
And this is why language debates can't be settled via logic alone.
I'm genuinely curious why you think that it's worse in functional languages than, eg Python or C.
It's not like you don't specify all of those variables when using a loop in C -- you just have a special syntax to. I was outlining the actual recursion mechanism, not showing what you'd have to code....
You can make it look basically the same, with a signature like...
...which in practice will look like... The only annoyance is the slightly verbose lambda syntax for the test, but if you're using a function as a test, it becomes a smaller issue.