Andrei's list of barriers to D adoption
Adam D. Ruppe via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 7 16:59:37 PDT 2016
On Tuesday, 7 June 2016 at 20:41:08 UTC, Walter Bright wrote:
> The point being that a culture of "best practices" does arise
> and evolve over time, and professional programmers know it.
Sure, that's one of the big advantages C++ has over D: people
have that institutional knowledge.
But, two important questions:
1) You criticize C++ because it isn't good enough - programmers
are lazy and just because you can do it right doesn't mean they
will. The right thing also needs to be the easy thing.
D's attribute spam is not the easy thing. And there's no apparent
punishment for doing it "wrong" - everything works equally well
for the author. It is only when a third party comes in and tries
to slap the attribute on that it becomes an issue.
2) What makes you so sure @nogc will actually be part of the best
practice? I haven't done a comprehensive study, but my impression
so far is that it is very rarely used: the biggest win is being
inferred in templates... which seems to imply that people aren't
caring enough to actually write it out.
> Would you want to use a library where the maintainers refuse to
> use @nogc even if they aren't using the gc?
I think you underestimate the cost of @nogc (and @safe, and pure,
and nothrow) to the library author. It is littering their code
with something they don't use themselves (and thus easy to forget
to put there on new functions) and don't derive any direct
benefit from.
Moreover, it limits their flexibility in the future: once a
function is published with one of those attributes, it is part of
the public interface so the implementation cannot change its mind
in the future. That might be a good thing to the user begging for
verified @nogc or whatever, but to the library author it is
another cost for them to maintain.
Though, the apathy factor I think is bigger than the maintenance
factor: I don't write it in my code because I just don't care. I
have had only one user ever complain too... and he seems to have
changed his mind by now and no longer cares either (probably
because a critical mass of library authors still just don't care,
so you can't realistically slap @nogc @safe on that much anyway).
More information about the Digitalmars-d
mailing list