preparing for const, final, and invariant

Manfred Nowak svv1999 at hotmail.com
Thu May 17 19:01:35 PDT 2007


Walter Bright wrote

> scope - the function will not keep a reference to the parameter's
> data that will persist beyond the scope of the function

>     g = a;	// error, a is scope

In this example the function assigns to a variable living outside of 
the scope of the function. Therefore the function does not keep that 
reference itself---and that rule should not fire.

In addition: if the rule's wording is changed to match that example, 
then it becomes unclear, whether `writefln( &a)' is allowed because 
`writefln' might store that reference somewhere---especially via OS in 
a file, which might be read in later by the calling process.

In case of disallowance that rule would disallow printing too.

-manfred



More information about the Digitalmars-d-announce mailing list