[OT] Modules dropped out of C++17

via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 23:36:42 PDT 2015


On Wednesday, 10 June 2015 at 01:28:40 UTC, Walter Bright wrote:
> I'm bemused by the argument that D is deficient because it 
> doesn't implement a non-existent feature of C++.

I think you are offended ;^]. I have not said that D is deficient 
regarding constexpr, I've suggested that I think D is moving more 
in a high level direction than C++. Which is neither good or bad, 
just different. "constexpr" has advantages and disadvantages.

But C++ constexpr was originally restricted to expression-like 
functions. Loops were added later (making it easier to init 
arrays)  AFAIK.

My primary use case for constexpr in C++ is:

1. Initializing global constant arrays. These functions I label 
"ct_make_lut_sin(size)" etc and only use them for that purpose.

2. Signifiying that a standard class member-function is returning 
a constant value in a particular version of the class where you 
expect a varying value, e.g. "size()".

I only add constexpr when I have to and only use constexpr 
functions that are O(N) and only where beneficial. It's more like 
"Do I _have_ to make this constexpr?", not "Oh yes, I can make 
this constexpr!".

However, D's primary advantage over C++ is that D is easier to 
get into. No sane person would want to learn C++ from scratch (if 
they have other options). C++XX is more for people that already 
know it or have to learn it (for work).

D's position will benefit from becoming simpler and more 
streamlined, not more complex, so "constexpr" is not the right 
thing for D, IMO. (Rust and C++ have complexity as a 
barrier-to-entry)

> some of these posts. I'm hoping to entice you to contribute in 
> the substantial way that I know you can.

I think prodding people to view things differently is 
substantial, besides it helps me figure out what I want from a 
language ;-). But I suppose you mean code, I am thinking about 
doing comparative synthetic benchmarks between 
"idiomatic/readable" C++, Rust and D vs "not-so-readable hardware 
oriented C".

I think you will find that more people will chime in when the 
compiler has completed the transition to D and the codebase has 
been refactored. It doesn't make much sense to get into the C++ 
codebase at this point where you are transitioning.


More information about the Digitalmars-d mailing list