Casts and conversions done right

bearophile bearophileHUGS at lycos.com
Mon Jul 20 03:14:11 PDT 2009


Lars T. Kyllingstad:
> Instead, I propose the above operations be written like this:
>    int i = to!int(pi);    // The to function already exists in std.conv
>    int j = cast!int(pi);

I think this topic needs quite more thinking, but I agree that the current casts of D are not good enough and have to be improved. Probably your solution isn't the best design, but it's looks better than the current one. Merging all different kinds of casts in a single syntax is bad.

Bye,
bearophile



More information about the Digitalmars-d mailing list