Proposal: 'auto' members and returning 'auto' instances

Daniel Keep daniel.keep.lists at gmail.com
Tue May 23 23:25:06 PDT 2006


Hooray!  Someone replied!  ^_^

R������������������������������������� wrote:
> This seems to be like a kind of C++ "const" for memory � la D. Would these auto
> variables complicate the type system, as in C++ ? Could it be done using some
> "scope ( exit ) { delete var1, var2, var... ; }" ?
> This extended use of auto may add some ambiguities with the "auto" type
> inference.  This latter may use an other keyword like "let" to have things like:
> let sc = new SomeClass (); // type inference, with an Ocaml look. 
> auto let sc = new SomeAutoClass (); // auto variable and type inference.
> 

It doesn't change existing semantics for auto-destroyed objects EXCEPT
to allow them to be a return type, and allow them as object members.

Type inference will continue to work exactly as it did before.

As for doing it manually, indeed you could!  But then, 'auto' in it's
current form can be done manually.  'auto' exists to help the programmer
write safer, more predictable code.  This is just extending where you
can use it a little.

	-- Daniel Keep

P.S.  Thanks for commenting; I was beginning to wonder if anyone had
even read it :P

-- 

v1sw5+8Yhw5ln4+5pr6OFma8u6+7Lw4Tm6+7l6+7D
a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP    http://hackerkey.com/



More information about the Digitalmars-d mailing list