D as a Better C

H. S. Teoh via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Aug 23 17:55:52 PDT 2017


On Thu, Aug 24, 2017 at 12:35:22AM +0000, Michael V. Franklin via Digitalmars-d-announce wrote:
[...]
> Consider this:  Rust doesn't need a special switch to make it
> interoperable with C.  What's wrong with D's implementation that
> requires such things?  Granted, D is not Rust, but D's implementation
> could be improved to make it more competitive with Rust in these use
> cases.  For example, there is really no need for TypeInfo if you're
> not doing any dynanmic casts, but the current implementation generates
> it regardless.  I find -betterC to be somewhat of a copout for
> avoiding the hard work of improving D's implementation.
[...]

One thing that would help is if things like TypeInfo, ModuleInfo, etc.,
are only emitted on-demand, or if they are stored as weak symbols in the
object file so that the linker can just omit them if they are never
referenced.

Ideally, the GC would also be on-demand, but it's currently too tightly
integrated with druntime for this to be possible. At least, it would
take a huge amount of effort to make it work.  Similarly, thread-related
stuff might be difficult to make optional, since the D startup code is
dependent on it.

Other smaller things in druntime like string switches, array comparison
functions, etc., could possibly also be optionally included, but then
you'll need to link (parts of) druntime. It will be more troublesome,
but within the realm of possibility, I think.

I, for one, would be happier if D's features are more pay-as-you-go so
that simpler programs don't have to pull in a whole bunch of executable
bloat that's not actually going to be used.


T

-- 
Let's eat some disquits while we format the biskettes.


More information about the Digitalmars-d-announce mailing list