Greenwashing

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri May 29 22:19:37 UTC 2020


On Thursday, May 28, 2020 2:41:43 PM MDT Meta via Digitalmars-d wrote:
> On Thursday, 28 May 2020 at 00:31:09 UTC, Jonathan M Davis wrote:
> > On Wednesday, May 27, 2020 5:57:00 PM MDT Meta via
> >
> > Digitalmars-d wrote:
> >> On Wednesday, 27 May 2020 at 18:50:50 UTC, Jonathan M Davis
> >>
> >> wrote:
> >> > Based on some of Walter's comments, it also sounds like he
> >> > intends to make nothrow the default in another DIP, which is
> >> > also a terrible idea. I'm increasingly worried about the
> >> > future of D with some of where these DIPs are going.
> >> >
> >> > - Jonathan M Davis
> >>
> >> What's wrong with nothrow by default? Probably 97% of code
> >> doesn't need to throw exceptions.
> >
> > If anything, I would say the opposite.
> >
> > <snip>
>
> I find that response surprising, given that you used to use
> Haskell (do you still?), which gets along fine without exceptions.

Functional languages are a very different beast from imperative or
multi-paradigm languages. So, to a great extent, we're talking apples and
oranges when comparing them. Regardless, Haskell avoids some of the pitfalls
of not using exceptions while being pretty firmly stuck with others. Because
it's purely functional, you can't easily ignore the results of functions,
which makes error-codes (or monads with error reporting) less error-prone
than they are in languages like C++, Java, or D, but the result still
clutters the code considerably. It's very typical in Haskell that you're
stuck passing monads in one form or another well up the call stack, so the
error-handling effectively infects the whole program instead of being
segregated to the portions where it's most appropriate to deal with it. And
of course, it gets that much more fun when you need to be passing multiple
things up the call stack via monads.

Ultimately though, Haskell is so different from D that it's hard to really
talk about best practices from one applying to the other. Personally, I
think that it's great to spend time using a functional language as your main
language for a while, because it forces you to get better at functional
programming practices such as recursion - but it forces it by not letting
you have the full toolbox like a multi-paradigm language does. I'm _much_
more comfortable with stuff like templates and range-based code than I would
have been had I not spent a fair bit of time programming in Haskell
previously, but honestly, I hate functional languages. They're far too
restrictive, and I don't understand how anyone can seriously program in them
professionally. Debugging Haskell is a disgusting, unpleasant process in
comparison to an imperative or OO language. I highly recommend that
programmers spend some time in functional land to improve their skills, but
I would never want to program with such tools for a living.

Regardless, as far as code in languages like D, C++, C#, Java, etc. goes,
exceptions are by far the cleanest and least error-prone way to deal with
error conditions in general. They definitely aren't always appropriate, but
for your average program, they're how I'd expect most error-handling to be
done.

- Jonathan M Davis





More information about the Digitalmars-d mailing list