From: Johnny Morrice Date: 2011-04-05T19:14:54+09:00 Subject: Re: functional languages -- any recommendations? On Tue, 5 Apr 2011 18:13:44 +0900 Johnny Morrice wrote: > Haskell doesn't have the feature called inheritance in Object Oriented > Languages*. > > Living without objects is okay, but it means you can't create a new > data-type that inherits members from another data-type. > > It has other mechanisms for code-reuse, but sometimes things which > would be really simple with, for example, a template method, into a > bit of an exercise in formal logic. Still, that's okay because that's > pretty much how you program the whole of the system in Haskell. Now that I think about it, the template method is a bad example. In Haskell you can inherit from abstract interfaces - you can't inherit from a data structure. So you can easily have a template method, it's just that it would have to defined as part of the abstract interface. So each child that implements the template would have to implement the interface. Then since you can't inherit from the data type, the children must be a whole new type which has the parent as a member, and pass that to the template method. At this point any functions which could have been run on the parent will now have to be reclared for the child :( Then again with the separation of code and data you start to consider if that really is the structure of your program. But usually by that time in Ruby, I'm already done! In conclusion, I'm too stupid to program in Haskell. If you choose it, good luck. Cheers, Johnny