Re:What are potential disadvantages of functional programming?
by banachtarski on Thursday July 27, 2017 @08:11PM
(#14870929)
Inability to practice hardware sympathy is the biggest drawback for me. With imperative code, my intuition can be useful in estimating what instructions the compiler is likely to generate (what loops get unrolled, how registers get packed, etc). It's still not easy mind you, but with functional languages, the generated code goes through another battery of passes and abstractions that obscure this even more.
[ Parent
| on HN ]
Re:What are potential disadvantages of functional programming?
by wyc on Thursday July 27, 2017 @08:20PM
(#14870964)
If you go deeper, then we start to see a lot of similarities. Functional programming strongly resembles circuit logic. Maybe a strange loop?
See also http://www.clash-lang.org/
Re:What are potential disadvantages of functional programming?
by banachtarski on Friday July 28, 2017 @01:39AM
(#14872223)
I've coded in vhdl and verilog. Working at the gate level is definitely more functional in nature and has the same problem (it's not obvious intuitive how the code you write maps to gate logic). Hence, why novices introduces accidental latches and metastability. I've actually used clash for one non-trivial project, and there's something interesting there for sure.
Re:What are potential disadvantages of functional programming?
by nerpderp83 on Thursday July 27, 2017 @08:15PM
(#14870941)
Functional code can do better fusion, inference and unrolling than imperative code.
Re:What are potential disadvantages of functional programming?
by 0xbear on Thursday July 27, 2017 @08:18PM
(#14870949)
Citation needed. Not saying it's not true, just haven't seen it in practice. Usually if you want efficiency, you have to drop down to intrinsics or assembly, no matter how much the compiler is helping you.
Re:What are potential disadvantages of functional programming?
by juliangamble on Thursday July 27, 2017 @08:24PM
(#14870974)
Look at the publications here http://benl.ouroborus.net/
Also look at the Disciplined Disciple Language (related to Haskell).
Re:What are potential disadvantages of functional programming?
by nerpderp83 on Tuesday August 01, 2017 @04:12PM
(#14904832)
Thanks for the links!
Re:What are potential disadvantages of functional programming?
by banachtarski on Friday July 28, 2017 @01:44AM
(#14872241)
It's not a question of whether it "can" or not sometimes. Say there's a performance issue in your code. In my experience, I have a much easier time figuring out where the bottleneck is just by inspection with imperative code than with functional code (especially when concurrency is involved). Sometimes, transparency is more important than raw output.