suggestion of implicit new

Tom S h3r3tic at remove.mat.uni.torun.pl
Wed May 31 15:40:59 PDT 2006


shinichiro.h wrote:
> Hi all,
> 
> I guess D syntax can allow implicit new expression like following:
> 
> class C {
>   this() {}
>   this(int x) {}
> }
> void func() {
>   C c = C();  // not new C()
>   c = C(3);   // not new C(3)
> }
> 
> I think the syntax is cute. And the syntax is not ambiguous and does
> not make DMD slower. I have succeeded to implement the syntax into

Well, it is ambiguous if the class contains a static opCall, but then 
again, I'd suggest that syntax instead of the current 'auto' storage 
modifier.

auto C c = new C();      // would become    C c = C();
// and
C c = new C();     // would stay the same


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d mailing list