preparing for const, final, and invariant

Walter Bright newshound1 at digitalmars.com
Sun May 20 20:10:44 PDT 2007


Regan Heath wrote:
> Why not make this implicit 'in' parameter 'scope const final' avoiding the need to explicity say 'in' everywhere?

It's a good idea, but then there needs to be some way to pass a mutable 
reference. Such as:

class C { int x; }
void foo(C c)
{
     c.x = 3;
}

That doesn't work if 'const' is the default. Using out or inout doesn't 
work either, as those have slightly different semantics (an extra level 
of indirection).



More information about the Digitalmars-d-announce mailing list