auto, var, raii,scope, banana

Andrei Khropov andkhropov at nospam_mtu-net.ru
Fri Jul 28 03:50:23 PDT 2006


kris wrote:

> Someone noted that
> 
>  x = SomeName();
> 
> is confusing, since it doesn't convey whether a class is instantiated, or a
> function is called. That's part of the issue noted above, and it becomes
> worse when dropping the optional parens
> 
>  x = SomeName;
> 
> Whereas it is still perfectly meaningful when using new instead:
> 
>  x = new SomeName;

Yes, that's an essential flaw in this proposal.

Another one was mentioned in
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/40740 :

<quote>

But how does this proposed syntax handle variable-length arrays?

  char[] a = read(filename);

Is 'a' destroyed at end of scope? 

</quote>

So we'll lose the ability to initialize scope variables by function return
value.

-- 
AKhropov



More information about the Digitalmars-d mailing list