On Thursday, 17 July 2014 at 14:05:02 UTC, Brian Rogoff wrote:
On Thursday, 17 July 2014 at 13:29:18 UTC, John wrote:
If D came without GC, it would have replaced C++ a long time
ago!
That's overly optimistic I think, but I believe that the
adoption rate would have been far greater for a D without GC,
or perhaps with a more GC friendly design, as the GC comes up
first or close in every D discussion with prospective adopters.
This claim is being made frequently, but you need to consider
that D started out as a more simpler language than it is today.
Many of the distinguishing advantages of D can only be made
possible _in a safe way_ when there is a GC. Everyone seems to
agree, for example, that array slicing is one of these features.
Without a GC, you'd either have to add a complicated reference
counting scheme, thus destroying performance and simplicity, or
you'd have to rely on the user for ownership management, which is
unsafe. (A third way would be borrowing, which D doesn't have
(yet).) I also believe that the Range concept was introduced at a
later stage in D's history, thus the GC avoidance strategies that
are being implemented in Phobos right now weren't available back
then.
Therefore I cannot agree that D would have been adopted more
eagerly without a GC; in fact, the adoption rate would have
likely been less, because the language would have been crippled.
However, it's way too late to change that now. IMO, the way
forward involves removing all or most hidden allocations from
the D libraries, making programming sans GC easier (@nogc
everywhere, a compiler switch, documentation for how to work
around the lack of GC, etc.) and a much better, precise GC as
part of the D release. Any spec changes necessary to support
precision should be in a fast path.
Add borrowing!