Current state of "D as a better C" (Windows)?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Jan 25 19:28:54 PST 2014


On 1/25/14 6:32 PM, Frank Bauer wrote:
>> There aren't that many language features that depend on a GC, and the
>> ones that do can be disabled with a custom runtime.
>
> I don't want to miss out on a single language feature of D. Where is
> that GC-free runtime?

GC is a language feature of D.

As funny as that may seem (as a comeback timed almost too well) this has 
interesting truth to it. Some convenience features of D require GC to 
work, and that's as cut and dried as it gets. Without them, D would need 
to sacrifice some features or complicate the language or concentrate 
focus on that aspect alone (and I suspect Rust is guilty of at least 
some of the above).

You can't have all of D without GC for the simple reason that GC is 
convenient and simplifies things, and often such things are desirable. 
Of course, reducing within reason, modularizing, and compartmentalizing 
the need/use of GC is a goal worth working toward. But all that requires 
reason and measure.

>> druntime/Phobos are designed for a mixed allocation strategy, where
>> tracing GC is one of the strategies used. Many Phobos types and
>> functions do not rely on a GC.
>
> In theory (which gives me hope), not in practice. Where is that GC-free
> Phobos?
>
>> Java and C# do not function well without GC at all (disregarding the
>> effort you'd have to go through to get a Java or C# implementation
>> without GC).
>>
>> D definitely *does*.
>
> Again, this gives me hope. Please Walter, Andrei: search all the forums
> for "I want D with opt-in GC" (fuzzy search, that is) and count matches.

We believe the clamor is overblown. The patterns in which D produces 
garbage (litter, for the most part) are very different from those in 
languages that don't offer a choice. Focusing on library functions that 
produce a few garbage-collected strings when the bulk of the load is 
elsewhere - that's penny wise and pound foolish.

That said, it's good to have control and rein in over how and where 
litter is produced. We see this as an ongoing focus.


Andrei



More information about the Digitalmars-d mailing list