Thread overview
Compiler support for T(n) notation for initialization of variables
Jun 07, 2014
Peter Alexander
Jun 07, 2014
bearophile
June 07, 2014
Hello all,

Just a quick check -- which version of the dmd frontend introduces support for the notation T(n) to initialize a variable as type T?  Is it 2.065 or the upcoming 2.066?  I ask because as I'm always running git-HEAD DMD, I'm never entirely on top of what's in which version ... :-)

Thanks & best wishes,

    -- Joe
June 07, 2014
Well, it doesn't work in 2.065, so must be 2.066 :-)

P.S. thanks for letting me know about this feature. I had no idea it was going in!
June 07, 2014
Joseph Rushton Wakeling:

> which version of the dmd frontend introduces support for the notation T(n) to initialize a variable as type T?  Is it 2.065 or the upcoming 2.066?

In 2.066.

Bye,
bearophile
June 07, 2014
On 07/06/14 19:57, Peter Alexander via Digitalmars-d-learn wrote:
> Well, it doesn't work in 2.065, so must be 2.066 :-)
>
> P.S. thanks for letting me know about this feature. I had no idea it was going in!

I only discovered it when I was advised to use it in a recent Phobos PR of mine. :-)

The reason I wanted to know is to check whether or not it was "safe" to use it in library code that might conceivably be used with earlier compilers.  I think requiring 2.065+ is reasonable, but requiring 2.066 obviously is not.

Oh well, (cast(T) 1) it is then. :-(

(I think that to!T will also work with a compile time constant, but it feels a bit dodgy to import std.conv for something like this.)
June 07, 2014
On 07/06/14 19:57, bearophile via Digitalmars-d-learn wrote:
> Joseph Rushton Wakeling:
>
>> which version of the dmd frontend introduces support for the notation T(n) to
>> initialize a variable as type T?  Is it 2.065 or the upcoming 2.066?
>
> In 2.066.

Thanks for the confirmation :-)