Chad Perrin wrote:
> On Wed, Aug 09, 2006 at 11:57:03PM +0900, Francis Cianfrocca wrote:
>> 
>> I've often been mystified when people talk about Ruby's metaprogramming, 
>> closures, lambdas, etc. as constituting a "functional" programming 
>> style. Your comment is striking because it made me realize that perhaps 
>> many people who learn languages like Scheme are actually trying to apply 
>> the imperative, Turing-style computational model to languages that don't 
>> support them. And that reinforces all the more my intuition that pure FP 
>> is not well-suited for mainstream professional programming.
> 
>  1. A functional "style" is not the same as a functional "language".
>  The adoption of certain coding techniques that arose in functional
>  languages for use in a language that is more object oriented and
>  imperative in syntax in no way changes the fact that those techniques
>  come from a programming style that arose due in large part to a
>  functional syntax.
> 
>  2. I agree that *pure* functional programming is not well-suited to
>  mainstream professional computing, but then, neither is *pure*
>  imperative programming.  That doesn't change the fact that a whole lot
>  of functional programming syntactic characteristics can be crammed into
>  a language before passing the point of diminishing returns.  In fact, I
>  think that something as simple as teaching students to use prefix
>  arithmetic notation in grade school would turn the tables such that
>  functional programming syntax would probably be by far the "most
>  natural" to nascent programmers by quite a wide margin.


This thread has probably gone on long enough ;-) but as I read it, what 
you're saying here amounts simply to "let's take what's good from each 
approach and apply it generally." Can't argue with that.

I find it very revealing that you see the primary (borrowable) value in 
functional languages as coming primarily from *syntactic* elements. 
Again I may be misreading you, but you can get syntactic innovations 
from anywhere. The thing that really distinguishes functional programs 
is that you can reason mathematically (and one hopes, automatically) 
about their correctness. Rather than being stuck with the whole sorry 
round of unit-test/debug/regress/repeat that we use with Ruby and every 
other non-functional language. Apart from the reference to Ada/Diana (a 
sub-language with a rigorous formal semantics), I haven't heard anyone 
on this thread try to relate this benefit of functional languages to 
non-functional ones.

To answer someone else, the ability to automatically process programs is 
why I'm interested in mini-languages (DSLs) written in Ruby that are 
non-Turing complete, because they may be decidable, if designed 
properly. That opens the way (in theory) to the kind of automatic 
correctness analyzers that you see in pure functional programming. The 
potential economic benefit is staggering. What proportion of your 
programming time do you spend debugging today?

If people see the distinctions between "functional" and "non-functional" 
languages purely in syntactic terms, then this whole discussion is 
really no deeper than yet another Ruby vs. Python debate.

-- 
Posted via http://www.ruby-forum.com/.