Learning Haskell makes you a better programmer?

Timon Gehr timon.gehr at gmx.ch
Wed Dec 26 15:13:01 PST 2012


On 12/26/2012 11:09 PM, Walter Bright wrote:
> On 12/26/2012 8:34 AM, Russel Winder wrote:
>> But isn't that the whole point, in functional programming there is only
>> immutable data.  Thus a programming language that allows mutable data
>> cannot really be said to be usable for functional programming style.
>
> In D, you can declare immutable data and immutable data structures. This
> makes it usable for FP style (along with checkable function purity).
>

immutable and const are incompatible with lazy evaluation. Lazy 
evaluation is not strictly necessary for FP, but it makes code a lot 
more expressive. (D ranges are lazy.)

> But D also does something I think is fairly unique. A function can be
> pure, but inside that function, mutation is allowed as long as that
> mutation does not "leak" outside of the function.  A pure function with
> immutable parameters does completely specify the function in its
> signature. What happens inside the function is not relevant, it is not
> necessary that locals be immutable.
>

Haskell has this.


More information about the Digitalmars-d mailing list