From: bruno modulix Date: 2004-07-13T04:47:23+09:00 Subject: Re: Functional Ruby (Re: Why I don't use Ruby.) Sean Russell a �crit : > Mikael Brockman wrote in message news:<87llhx2hec.fsf@phubuh.org>... > >>Lots of functional languages lack pattern matching. Scheme, for >>example. One can write Scheme-styled code in Ruby. > > > In this, and following posts, you make the claim (directly and > indirectly) that all languages are functional languages, rendering the > term "functional language" meaningless, or at least useless. I > oppose attempts to generalize words into meaninglessness. > > There *are* good, useful definitions of what constitutes a functional > languages, and Ruby does not match the criteria for most of them. > Probably the most fundamental of all criteria is that the language > does not allow side-effects, such as assignment. Scheme, Common Lisp and Caml -- three major fpl's -- allow assignement. FWIW, here is the definition of 'functional programming' on the c.l.functional's FAQ : """ Functional programming is a style of programming that emphasizes the evaluation of expressions, rather than execution of commands. The expressions in these language are formed by using functions to combine basic values. A functional language is a language that supports and encourages programming in a functional style. """ (http://www.cs.nott.ac.uk/~gmh//faq.html#functional-languages) Following this definition, Ruby is somewhat on the functional side, since it's an 'everything is an expression' language !-) What else ? Anonymous functions ? Closures ? HOF ? AFAIK, Ruby has it all (or I'm I wrong ?)... (snip) > > Now, a better example would have been to point out OCaml, which is > *both* functional *and* OO, something which I believe is fundamentally > impossible, in that it can't be pure OO and pure functional. However, > it has a lot of features associated with functional languages, and > many features associated with OO, so it can claim to be a functional > language with OO capabilities. For the record, Common Lisp (and IIRC Scheme) also have a strong support for OO. Bruno