Explicit implicit conversions

Paul Backus snarwin at gmail.com
Thu Feb 6 03:03:05 UTC 2025


On Thursday, 6 February 2025 at 02:32:54 UTC, Quirin Schroll 
wrote:
> The idea is to allow, e.g. `Type(expression)` evaluate to 
> `expression` with a static type of `Type`.

Unfortunately this syntax conflicts with constructors and `static 
opCall`, so it is probably a non-starter.

> Of course, that lowering can be provided by a function template:
> ```d
> auto ref R implicitCast(R, T)(auto ref T x) => x;
> ```
> The main issue with that is that it’s much wordier.

Do we expect this to be used often enough that its length will be 
a big deal?


More information about the dip.ideas mailing list