If you could make any changes to D, what would they look like?
b2.temp at gmx.com
Wed Oct 20 15:45:59 UTC 2021
On Wednesday, 20 October 2021 at 09:47:54 UTC, SealabJaster wrote:
> Just for giggles, without pesky things like breaking changes;
> rational thinking, logical reasoning behind the changes, etc.
> What interesting changes would you make to the language, and
> what could they possibly look like?
Optional access operator. I tend to write more and more
conditional expression with `null` as the third operand.
For example I count 93 occurences of the pattern in styx.
Not convinced that this is a very common construct ?
Let's take a look at dmd: **490** occurences.
Example picked from dmd:
StringExp se = ex ? ex.ctfeInterpret().toStringExp() `: null`;"
StringExp se = ex?.ctfeInterpret().toStringExp();
Please abstraint you to reply to me with remarks like _"this can
be done using metaprog"_ ... I know because I did it too a few
years ago (using `opDispatch`).
This should be built in the language because
1. the template solution is necessarily slow to compile
2. it is better for tooling
More information about the Digitalmars-d