Blog post: What D got wrong

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Dec 19 02:17:16 UTC 2018


On Tuesday, December 18, 2018 1:17:28 AM MST Russel Winder via Digitalmars-
d-announce wrote:
> On Mon, 2018-12-17 at 12:16 -0800, Walter Bright via
> Digitalmars-d-announce
> wrote:
> > […]
> >
> > Going pure, however, is much harder (at least for me) because I'm not
> > used to
> > programming that way. Making a function pure often requires
> > reorganization of
> > how a task is broken up into data structures and functions.
> >
> > […]
>
> I can recommend a short period of working only with Haskell. And then a
> short period working only with Prolog. Experience with Java and Python
> people trying to get them to internalise the more declarative approach to
> software, shows that leaving their programming languages of choice behind
> for a while is important in improving their use of their languages of
> choice.

+1

The only reason that I'm as good at writing functional-style code as I am is
because I used Haskell as my goto language for a couple of years towards the
end of college. By being forced to program functionally, I got _much_ better
at things like recursion, and it significantly improved aspects of my
programming in languages like C++ or D.

That being said, I think that anyone who programs in such a language
longterm by choice has got to be a masochist. Functional programming is a
fantastic tool to have in your toolbox, but man does it force you to contort
things to make it work in many cases. I've never spent as much time per line
of code with any other language as I did with haskell. It's great for
stretching your brain but terrible for being productive. I'm sure that folks
who always program that way get much better at it, but some problems simply
work better with other programming paradigms, and it's fantastic to use a
language like D that allows you to program in a variety of paradigms rather
than forcing a particular paradigm on you all the time. But without spending
a lot of time in a language that forces a particular paradigm, you're likely
to be much worse at that particular paradigm in a flexible language such as
D.

One side effect of having spent as much time as I did with haskell is that
I've rarely found the functional nature of D's templates to be much of a
problem. Sometimes, it can be, and the addition of static foreach is
certainly welcome, but I rarely missed it, because I rarely needed it. The
declaritive stuff just tends to fit nicely into the functional paradigm in
ways that normal functions often don't. LOL. And it took quite a while
before I realized that templates were really a functional language (in fact,
I think that I only realized it when I read Bartosz's article on the
subject). I just understood how to use them and didn't think about it,
though once I did realize it, I felt stupid for not having realized it.

- Jonathan M Davis






More information about the Digitalmars-d-announce mailing list