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

Jakob Ovrum jakobovrum at gmail.com
Sat Jan 25 15:01:11 PST 2014


On Saturday, 25 January 2014 at 22:15:29 UTC, Frank Bauer wrote:
> D is NOT a systems language. So no point in application level
> comparison with C. Set aside syntactic similarities.

Urgh...

> If your language does not have the C / C++ *semantics* of new /
> delete,

Setting aside syntax, it's extremely trivial to implement 
C++-style new/delete as function templates.

> or, better yet, owned pointers in Rust that automatically
> free their memory when they go out of scope, but instead forces 
> a
> GC down your throat for some of the most basic array and 
> standard
> library functionality,

Array functionality *that C and C++ do not have*. D slices are 
plenty useful without the primitives that allocate, such as 
concatenation. This very thread is an example of how you're not 
forced to use a runtime that implements these primitives.

> Other than that, a "D with owned pointers" and an opt-in GC
> relegated to a library implementation (maybe with some minimal
> language hooks) would be my language of choice. I love D's
> templates.

The GC is a library implementation with language hooks.

> I understand that this would be a complete redesign of the
> language and Phobos, and would break most of the D code out
> there. That's why it won't happen.

There aren't that many language features that depend on a GC, and 
the ones that do can be disabled with a custom runtime.

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.

> Everybody seems to realize this, finally. Just have a look at 
> the
> last (long) GC thread. Comparisons of D with Java and C# all 
> over.

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*.


More information about the Digitalmars-d mailing list