[OT] What are D's values?

Paul Backus snarwin at gmail.com
Mon Oct 4 23:39:05 UTC 2021


On Monday, 4 October 2021 at 22:15:33 UTC, Walter Bright wrote:
> Interestingly, left off is one thing that D does very well at: 
> plasticity. What do I mean by that?
>
> I've been developing code for a loooong time. I've noticed a 
> couple long term trends with C and C++ code. One is brittleness.
>
> This manifests itself in the strange characteristic that no 
> matter how many years I work on a piece of code, the very first 
> organization of it and the structure of it never fundamentally 
> changes. Oh, I endlessly tweak it and optimize it and enhance 
> it, but it's still the original design under the hood.
>
> I.e. it is brittle.
>
> With D code, however, I've found it to be far easier to change 
> the design. Optimization becomes not so much sweating the 
> details, but lowered barriers to trying out different designs 
> to see what works better. I did this extensively on the Warp 
> preprocessor project.
>
> I discovered a key component of this is D's use of . instead of 
> ->. One can easily test drive with classes, structs, pointers, 
> and values, interchanging them as one would try on a shirt. 
> It's such a frackin' nuisance to do that in C and C++, one just 
> doesn't bother.
>
> This is plasticity, the opposite of brittleness.
>
> What are your experiences with this?

I've experienced this too.

In D, with a little ingenuity, it is possible to make almost any 
surface-level syntax "desugar" to almost anything you want. Which 
means that when you want to change how some part of your program 
is implemented, you can almost always keep the original syntactic 
"interface" stable while doing so.

There are a lot of little language features that add up to make 
this possible. Implicit pointer dereferencing (as you mention), 
UFCS, optional parentheses, IFTI, operator overloading...probably 
some more that I'm forgetting.

I think this "plasticity" is probably closely related to 
"expressiveness", because the language features that contribute 
to one tend to also contribute to the other. Depending on how you 
interpret "expressiveness", they might even be the same thing 
(something like, "number of possible 'implementations' for a 
given piece of syntax").


More information about the Digitalmars-d mailing list