Proposal for design of 'scope' (Was: Re: Opportunities for D)
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 11 07:29:57 PDT 2014
On Fri, Jul 11, 2014 at 08:56:10AM +0200, Jacob Carlborg via Digitalmars-d wrote:
> On 10/07/14 20:15, H. S. Teoh via Digitalmars-d wrote:
>
> > class C {}
> > C myFunc(C obj) {
> > obj.doSomething();
> > return obj; // will be rejected if parameters are scoped by default
> > }
>
> Hmm, why wouldn't that work? The scope where you called "myFunc" is
> guaranteed to outlive "myFunc".
[...]
Because the scope of the parameter 'obj' is defined to be the scope of
myFunc only, according to the current proposal.
T
--
What are you when you run out of Monet? Baroque.
More information about the Digitalmars-d
mailing list