On Wed, 2019-10-09 at 11:12 -0700, H. S. Teoh via Digitalmars-d-learn wrote:
[…]
> Actually, std.functional is somewhat of a misnomer. It mostly deals with
> higher-order functions, i.e., functions that return functions, currying,
> that sort of thing.  These are part of functional programming, but
> there's more to functional programming than that.  I'd say std.range and
> std.algorithm are another major part of functional-style programming
> support in D, along with the purity system.
[…]

I feel that it is best to leave functional programming to functional
programming language, e.g. Haskell, Scheme, etc. rather than try to do
functional programming in imperative languages, e.g. Java, C++, Rust, D. The
reason is things like lazy evaluation and the consistency of everything being
a function, etc. The underlying computational models of functional programming
languages and imperative programming languages need different mindsets to use
well. Witness the issues in using Scala.

Having said this, declarative programming can be pursued in functional
languages, logic languages (e.g. Prolog), and imperative languages. Tools such
as higher order functions are crucial to this, but currying is not, unless it
is core to partial evaluation as it is in Haskell.

Modern C++, D, Rust – but not Go – all admit programming using a declarative
way of working just as Haskell and Scheme do. My experience of emphasising
declarative programming in imperative languages is that people build smaller,
more comprehensible, and maintainable code that achives the goal compared with
using tradition imperative programming.

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to