Thoughts about D

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Nov 29 16:57:36 UTC 2017


On Tue, Nov 28, 2017 at 06:18:20PM -0800, Walter Bright via Digitalmars-d wrote:
[...]
> When the C version is 90K and the translated D version is 1200K, it is
> a barrier. It's a barrier for others, as well.
> 
> Another barrier for me has turned out to be the way assert() works in
> D. It just is not lightweight, and it visibly slows down dmd to have
> assert's turned on internally. The amount of machinery involved with
> it in druntime is way overblown. Hence, asserts in dmd are turned off,
> and that wound up causing me a lot of problems recently. There are
> even initiatives to add writefln like formatting to asserts. With
> betterC, asserts became lightweight and simple again.
> 
> Andrei's been directing some work on using templates more in druntime
> to reduce this, such as Lucia's work. Martin has done some work with
> array ops, too.
> 
> Exception handling support has been a bloat problem, too. DMC++ is
> built with all exceptions turned off. I've been writing PRs for dmd to
> greatly improve things so that it can generate similar code for RAII.
> (Exceptions require druntime.)
> 
> BetterC is a door-opener for an awful lot of areas D has been excluded
> from, and requiring druntime is a barrier for that.

Doesn't this mean that we should rather focus our efforts on improving
druntime instead of throwing out the baby with the bathwater with
BetterC?

For example, the way assert() works, if indeed it's overblown, then
shouldn't we rather fix/improve it?

While generally I would still use fullblown D rather than BetterC for my
projects, the bloat from druntime/phobos does still bother me at the
back of my mind.  IIRC, the Phobos docs used to state that the
philosophy for Phobos is pay-as-you-go. As in, if you don't use feature
X, the code and associated data that implements feature X shouldn't even
appear in the executable. It seems that we have fallen away from that
for a while now.  Perhaps it's time to move D back in that direction.


T

-- 
I've been around long enough to have seen an endless parade of magic new techniques du jour, most of which purport to remove the necessity of thought about your programming problem.  In the end they wind up contributing one or two pieces to the collective wisdom, and fade away in the rearview mirror. -- Walter Bright


More information about the Digitalmars-d mailing list