From: Florian Frank Date: 2005-10-20T07:07:50+09:00 Subject: Re: Functional with Ruby Louis J Scoras wrote: >Or is the problem that there are method calls at all? Isn't Haskell defined >in C? Eventually at some level you're going to have to maintain state. We >have C because of good old Von Neumann. > > One of the main problems for Ruby in being a functional programming language, is that it doesn't have functions. The closest thing are Proc objects, but you can store state in them as well. To apply them, you have to call the #call or #[] method. But it's certainly possbile to pretend, that they are functions. >Again, I'm very rusty, but doesn't this boil down to not having >side-effects? Is inject referentially transparent if you consider the >reciever to be an implicit parameter? > > You're still assigning and storing values, instead of only creating new bindings. But Haskell has to communicate with the rest of the system and the user, too. It only goes to much greater lenghts to hide this behind monads, and only show the pure functional facade. But I don't think it's necessary for a language to go that far in terms of purity, to allow for functional style programming. It's of course possible to do that to a certain degree (like you did above) in Ruby. And it's fun, too. :-) -- Florian Frank