functional
Walter Bright
newshound1 at digitalmars.com
Wed Mar 10 14:39:13 PST 2010
James Iry wrote:
> No, C does not support functional programming. It is pretty much
> impossible to write an interesting C program that does not mutate
> things. That's not a condemnation of C, I still have a soft spot in
> my heart for it, but it is a recognition of how C is deeply tied to
> an imperative model of computation.
>
> Still, I notice you haven't addressed the core of my argument:
> functional programming languages and purely functional programming
> existed before there were languages that could enforce the purity.
> So insisting that language X is not functional because it does not
> enforce purity is to redefine the phrase "functional programming
> language" away from its historical roots in the Lisps and the MLs.
I thought Andrei's reply addressed it better than I could have.
> There's a reason that Haskell is called a "purely functional
> programming language" rather than just a "functional programming
> language" and that is precisely to clarify one important dimension of
> difference from the ML family. (It's actually called a "non-strict
> purely functional programming language" to talk about another
> important dimension of difference, but that's not what we're talking
> about here.)
>
> I don't disagree that it is possible, and even easy to write
> imperative code in the (impure) functional languages in the Lisp and
> ML families. But I do disagree with the contention that that makes
> them anything but functional languages since the phrase "functional
> programming language" was invented precisely to talk about their
> ability to express purely functional code even if there was no
> automated static proof of that purity.
I don't understand why C programs cannot be written that don't mutate
things (other than for initialization - even pure functional programs
initialize things).
More information about the Digitalmars-d
mailing list