A few inconsistentcies left

Lionello Lunesu lio at lunesu.remove.com
Fri May 26 05:19:22 PDT 2006


> auto foo = local Foo;
> 
> where 'auto' denotes automatic type inference and 'local' replaces 'new' 
> to denote stack-based construction.  As far as 'local' is concerned, 
> it's too bad 'new' is so generic.  Perhaps it should be 'new local' for 
> scoped allocations?

or using the already available new() syntax:

auto foo = new(local) Foo;

(Of course this will cause conflicts with any overridden 'new' in the class)

Anyway, I think I've read a post from Walter in which he seemed to like 
the implicit new/ctor syntax:

Foo f = new Foo(...);// heap
Foo f(...); //stack


L.



More information about the Digitalmars-d mailing list