Why is D unpopular?

H. S. Teoh hsteoh at quickfur.ath.cx
Sun May 15 11:55:00 UTC 2022


On Sun, May 15, 2022 at 06:18:58AM +0000, forkit via Digitalmars-d wrote:
[...]
> I understand the appeal of making it easier to use C libraries in a
> otherwise D solution. But that does not progress or advance the nature
> of software development, and the responsibility programmers have to
> their clients.
> 
> I was (initially) attracted to D because of how it advanced the
> problem of writing safe code (particulary @safe). This is what would
> make D 'popular'.
> 
> But ImportC is short-sighted in my opinion, and is a step in the
> opposite direction.
> 
> The focus should instead be on @safe, not C.

Making it easier to use C libraries actually *increases* the motivation
to write @safe code.

Because, if I were to start a new project and I need to use a C library,
then if it was too hard to interface D with that C library, it'd
incentivize me to write the project in C instead. Net result: I write
more unsafe code -- because it'd be in C.

OTOH, if it was easy to integrate that C library, I would be motivated
to write D code instead.  Net result: I write more @safe code.  Sure
it's not 100%, but that's still better than 0%.

There is, of course, the option of rewriting said C library in D. But
that's a low-incentive option, because it requires a lot of time/effort,
and is a net loss from a business POV (why reinvent functionality that
already exists / increases time to market, which reduces
competitiveness).  Depending on which library you're talking about, this
cost could be very prohibitive.  Concrete example: text layout with
something like Cairo.  There is NO WAY I'm gonna be able to reinvent the
whole thing myself; that'd take me several lifetimes to pull off. (And
believe me, I've tried. Text layout is an extremely convoluted and messy
process, with tons of unexpected complexities in this day and age of
internationalization and Unicode.  It's not something you can just
reinvent in a fortnight; it took YEARS for existing solutions to be
produced, and requires expertise you probably do not have (and would not
have for years even if you were to start studying it now).  You can't
just throw it all out the window because OMG it's not written in D so
it's BAD!)

Which would you rather have -- more projects to be written in C because
that's the only way you can leverage this existing technology, because
it's too hard to use it from D; or more projects to be written in D
because you can easily use a C library with minimum friction, so you
actually *have* the option of writing it in D in the first place?


T

-- 
Живёшь только однажды.


More information about the Digitalmars-d mailing list