On Wednesday, 23 March 2022 at 00:51:42 UTC, Era Scarecrow wrote:
On Tuesday, 22 March 2022 at 21:23:43 UTC, H. S. Teoh wrote:
We already have this:
import std.conv : to;
int x;
long y;
y = x.to!long; // equivalent to straight assignment / cast
x = y.to!int; // throws if out of range for int
This particular usage can be useful, just not in the
*automatic* sense i was meaning.
Forgot to add this; for the more automatic mode maybe add a new
tag say @autodowncast, which may add the .to!passingtype leaving
said checks without needing to throw casts in a dozen places.
Though i doubt Walter or Andrei would go for it.