DIP25 draft available for destruction

Johannes Pfau nospam at example.com
Thu Feb 7 07:44:50 PST 2013


Am Thu, 07 Feb 2013 09:04:29 +0100
schrieb "deadalnix" <deadalnix at gmail.com>:

> On Thursday, 7 February 2013 at 07:41:57 UTC, Johannes Pfau wrote:
> > Am Wed, 06 Feb 2013 23:45:51 +0100
> > schrieb Robert <jfanatiker at gmx.at>:
> >
> >> What happened to the scope storage class for parameters.
> >> 
> >> Wouldn't this solve the problems, with the simple rule that 
> >> you are
> >> not allowed to pass transient objects by reference if the 
> >> parameter
> >> was not declared with scope? And if I understood correctly, the
> >> compiler is already capable of locally ensuring that the 
> >> address does
> >> not escape (to ensure the scope requirement), so we are all 
> >> set?
> >
> > This is an important question. How would this new proposal 
> > interact with
> > scope parameters?
> >
> 
> scope in not enough, as you can alias parameters (for instance 
> swap).

Can you give an example?

I understand the scope is not enough to completely replace the rules in
the proposal, but shouldn't it be legal to pass addresses of stack
variables in @safe code as a scope parameter? Could this cause issues
as well?


More information about the Digitalmars-d mailing list