First Draft: cast(ref T)... as shorthand for *cast(T*)&...
Walter Bright
newshound2 at digitalmars.com
Mon Jan 20 22:55:29 UTC 2025
On 1/19/2025 9:33 AM, Paul Backus wrote:
> Why not just add a simple `reinterpretCast!T` helper function to Phobos or
> druntime?
Great question.
`reinterpretcast!T` is just ugly. I never liked it in C++. `cast(ref T)`, on the
other hand, looks nice.
We've seen other aesthetic improvements in D, such as:
```
int square(int x) { return x * x; }
```
becomes:
```
int square(int x) => x * x;
```
and other shortened syntax for lambdas, and the `if` declaration variant.
More information about the dip.development
mailing list