New feature in git-head: Uniform construction for built-in types

Dicebot public at dicebot.lv
Fri Mar 7 04:45:02 PST 2014


On Friday, 7 March 2014 at 11:41:41 UTC, Andrej Mitrovic wrote:
> https://github.com/D-Programming-Language/dmd/pull/1356 was 
> recently
> merged (pull by Kenji), implementing this enhancement:
> https://d.puremagic.com/issues/show_bug.cgi?id=9112
>
> Example code:
>
> -----
> int n = int(1);
>
> int *p = new int(1);
> assert(*p == 1);
> -----
>
> I'm just curious what people think about the new feature. 
> Discuss!

I like it as it simplifies some generic code by providing uniform 
construction syntax. Not the silver bullet though, as you still 
can't do `auto t2 = T(t1)` for classes (without static opCall). 
But definitely can save on some `statif if`s.


More information about the Digitalmars-d mailing list