[OT] What are D's values?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Oct 4 23:16:00 UTC 2021


On Mon, Oct 04, 2021 at 07:35:08PM +0000, jfondren via Digitalmars-d wrote:
> On Monday, 4 October 2021 at 18:23:24 UTC, SealabJaster wrote:
> > On Monday, 4 October 2021 at 18:03:58 UTC, Steven Schveighoffer wrote:
> > > You have to be very religious about what templates you use in
> > > order to keep this compile time.
> > 
> > A sad truth about D.

To be fair, though, even with extensive template use, compile times
generally aren't horrible, unless you happen to use code that abuses
recursive templates (e.g., certain Phobos modules like std.format, or
(ack) std.regex, where the mere act of importing it adds about 1-2
seconds to your compile time).  For simple metaprogramming with
templates, compile-times are generally still within the realm of <5
seconds or so, which is still magnitudes faster than any non-trivial C++
project I've ever had to deal with.


[...]
> For branding, put a smiley face on this instead of calling it a sad
> truth.  Need to write a tiny static executable to do a single thing
> fast using low-level OS APIs so that it can achieve paranoid security
> for the sake of Perl or Python or bash scripts that call this program?
> Good candidate for BetterC. Want to write a near-throwaway script?
> Good candidate for 'import std' and tons of allocation. Want to write
> a daemon to replace a golang server that's too resource intensive?
> Better candidate for scoped imports and careful design with @nogc and
> nothrow helping you control where work is happening.
> 
> All that with the 'same' language, rather than "oh I'll use C", "oh
> I'll use Python", "oh now I can finally use my systems language".

+1, D is so versatile that it easily lends itself to all these diverse
use cases.  Sometimes it can even adapt itself across these use cases,
e.g., a number of my personal projects started out as throwaway
single-file, script-like hacks, but eventually developed into
full-fledged multi-module, multi-package programs.  If I had done this
in any other language, it'd have involved rewriting the program from
scratch at least 3-4 times.  With D, it can gradually and smoothly morph
itself from a one-off script into a full-fledged, properly-encapsulated
program without missing a beat.

Man, I love D.


> Of course I still want faster compilation of std.regex.

:-D


T

-- 
Кто везде - тот нигде.


More information about the Digitalmars-d mailing list