5 ms·
Inability to practice hardware sympathy is the biggest drawback for me. With imperative code, my intuition can be useful in estimating what instructions the com
by banachtarski 9y ago
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.
- nerpderp83 9y agoFunctional code can do better fusion, inference and unrolling than imperative code.
- 0xbear 9y agoCitation 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.
- juliangamble 9y agoLook at the publications here http://benl.ouroborus.net/ http://benl.ouroborus.net/ Also look at the Disciplined Disciple Language (related to Haskell).
- nerpderp83 9y agoThanks for the links!
- banachtarski 9y agoIt'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.
- deleted 9y ago[deleted]
- wyc 9y agoIf 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/ http://www.clash-lang.org/
- gizmo686 9y agoSee also https://www.youtube.com/watch?v=k02mEtPfdaQ https://www.youtube.com/watch?v=k02mEtPfdaQ
- banachtarski 9y agoI'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.