From: Nicholas Van Weerdenburg Date: 2004-07-14T12:16:39+09:00 Subject: Re: Functional Ruby (Re: Why I don't use Ruby.) In University, I worked with a language called Turing that had both procedures and functions. Is that a common idiom? In Ruby, would it be possible to extend "def" and maybe introduce a feature called "func" that adds some extra rules to what can be coded? Thanks, Nick Florian Gross wrote: > Sean O'Dell wrote: > >> Here's a question: are "pure" functional programming languages >> implemented according to their own rules? Internally, do they also >> never use variables? My guess is: no, or almost never. They break >> the rules internally to provide an interface that adheres to the rules. > > > It depends. Functional languages implemented in functional languages > will be written in a functional style of course. C is no functional > language, but most function language interpreters are written in C > where you have so many side effects that you *have* to capture > different states into variables. > > The idea of functional languages is that the only thing a function is > able to give to the outside is its return value. > > In such a pure functional world variables are no longer needed, > because you can just use the function call itself where you would > otherwise need to use the value that was captured to the variable. > >> They break the rules internally to provide an interface that adheres >> to the rules. In my opinion, a "pure" functional language would >> allow you to develop your own functions and use local variables so >> long as your functions interacted predictably with the outside world. >> It wouldn't be a "pure" functional language, but I would still call >> it a functional language. > > > Ruby doesn't use Objects at all in its implementation. In fact C > doesn't even have Objects. Yet Ruby is a pure object-oriented language. > > The implementation really has nothing to do with this IMHO. It's not > really part of the interface after all. :) (And there can be multiple > interpreters for the same language all written in different languages > of course. The really interesting parts of this are language > interpreters that are written in the very same language that they > interpret.) > > Regards, > Florian Gross >