DIP69 - Implement scope for escape proof references

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


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.

?


T

-- 
Real men don't take backups. They put their source on a public
FTP-server and let the world mirror it. -- Linus Torvalds


More information about the Digitalmars-d mailing list