Walter: Before you go and implement the new RAII syntax..

Sean Kelly sean at f4.ca
Mon Sep 4 23:18:19 PDT 2006


Derek Parnell wrote:
> 
> I strongly agree with Jarrett. 
> 
>      Foo f = <NEW> Foo();
> 
>   where <NEW> can be either 'new' or 'local', or even 'new local' but never
> omitted, when invoking the class constructor. The static opCall is probably
> not valuable and if removed I wouldn't mind, but this still would not
> justify omitting 'new' either.
> 
> BTW, I'm not wedded to 'local' but something, ... anything, that explicitly
> informs the reader that the object will be destroyed when it goes out of
> scope is needed. Leaving it out is not a good user interface.

If there's to be a symbol to signify "stack allocation" then it should 
be in place of <NEW> as Derek suggests and not preceding the entire 
declaration as 'auto' does now.  I'll admit I prefer this idea to having 
nothing there, but I could live with either.


Sean



More information about the Digitalmars-d mailing list