Minor extension to cast syntax

Janice Caron caron800 at googlemail.com
Wed Oct 31 13:41:20 PDT 2007


On 10/31/07, Gregor Richards <Richards at codu.org> wrote:
> The current syntax is more similar to
> calling a templated cast function:
>
> cast(int)(foo)
> cast!(int)(foo)
>
> That is, cast is a function with a template parameter of the type you're
> casting it to. This isn't how it's implemented at all of course, but the
> syntax is reminiscent of that, and I think that's the better analogy.

Indeed. And in D2, we've now also got

to!(int)(foo)

which follows the same pattern



More information about the Digitalmars-d mailing list