4 ms·
I like Ruby, and I like functional programming, but if you try to shoehorn statelessness into your Ruby programs, you will be fighting the language, and you wil
by stuffihavemade 15y ago
I like Ruby, and I like functional programming, but if you try to shoehorn statelessness into your Ruby programs, you will be fighting the language, and you will feel a lot of pain. All of the data structures are ephermal, even strings. So, the language will not give thet persisitent, relatively perfomant strutuctes that Haskell or Clojure provides. If you want functional Ruby, just go use Clojure.
- rlander 15y agoWhile I do agree with you that trying to shoehorn ruby into a pure functional style is a bad idea, I believe it's generally a good thing to try to write functional-style ruby: Functional in the small and OO in the large [1]. For example, you can have referential transparency in your methods, which will allow for easier debugging. You can also strive for simpler data structures and even freeze objects to make them immutable[2]. [1] http://www.johndcook.com/blog/2009/03/23/functional-in-the-small-oo-in-the-large/ http://www.johndcook.com/blog/2009/03/23/functional-in-the-s... [2] http://ontwik.com/ruby/better-ruby-through-functional-programming-by-dean-wampler/ http://ontwik.com/ruby/better-ruby-through-functional-progra...