is there any reason UFCS can't be used with 'new'?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 30 12:24:38 PDT 2014


On 9/30/14 2:07 PM, Ali Çehreli wrote:

>
> Apparently, a class definition even inside a unittest blocks are
> considered to be nested classes.
>
> Normally, objects of nested classes are created by the 'this.new'
> syntax, 'this' meaning the object that wraps the nested class.

I think unit test blocks are actually functions disguised as attributes.

So it makes sense.

void foo()
{
    class C {}
    auto c = New!C; // same error
}

-Steve


More information about the Digitalmars-d-learn mailing list