Minor extension to cast syntax

Bruce Adams tortoise_74 at yeah.who.co.uk
Wed Oct 31 14:01:59 PDT 2007


Janice Caron Wrote:

> 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

to is a difficult word to google. The shriek doesn't help. Would someone care to enlighten me as to precisely what to does and how a "to" conversion differs from a cast?



More information about the Digitalmars-d mailing list