DIP69 - Implement scope for escape proof references

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 10:34:02 PST 2014


On Thu, Dec 04, 2014 at 10:31:07AM -0800, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Dec 04, 2014 at 01:57:43AM -0800, Walter Bright via Digitalmars-d wrote:
> > On 12/4/2014 1:53 AM, ketmar via Digitalmars-d wrote:
> > >cosmetic issue: some comments are referring to rules by number
> > >("Error, rule 5"), yet the rules aren't explicitly numbered. not a
> > >big deal, but still somewhat hard to follow.
> > 
> > Yeah, still learning wiki markup!
> 
> I don't understand the line where rule 5 was invoked:
> 
> 	scope int* a;
> 	...
> 	scope int** f = &a;    // Error, rule 5
> 
> Why is it an error, since f has a shorter lifetime than a? And what
> has it gotta do with rule 5, which currently reads:
> 
> 	A scope ref variable can be initialized with another scope ref
> 	variable - scope ref is idempotent.
> 
> ?
[...]

Ah, nevermind, it should be rule 4, not rule 5. Rule 4 states that the
address of scope variables cannot be assigned to another scope variable.
Please fix the comment. ;-)


T

-- 
I've been around long enough to have seen an endless parade of magic new
techniques du jour, most of which purport to remove the necessity of
thought about your programming problem.  In the end they wind up
contributing one or two pieces to the collective wisdom, and fade away
in the rearview mirror. -- Walter Bright


More information about the Digitalmars-d mailing list