Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  Imagine you've implemented a large program in a purely functional way.
  All the data is properly threaded in and out of functions, and there are no truly 
  destructive updates to speak of. Now pick the two lowest-level and most isolated
  functions in the entire codebase. They're used all over the place, but are never
  called from the same modules. Now make these dependent on each other: function A
  behaves differently depending on the number of times function B has been called 
  and vice-versa.

  In C, this is easy! It can be done quickly and cleanly by adding some global 
  variables. In purely functional code, this is somewhere between a major 
  rearchitecting of the data flow and hopeless.*
That's the actual problem with C -- people can (and therefore they do) make remote parts of the program depend on each other. One global is fine, but then comes another one, ... if there are two very remote, hidden functions that suddenly need to depend on each other then yes, it's OK if this is hard because you are fundamentally changing information flow in your system.


  …you are fundamentally changing information flow in your system.
And this is the key point. That the language/paradigm adds friction here is a good thing; it guides you towards a more appropriate implementation.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: