Proposal for scoped const contracts
Janice Caron
caron800 at googlemail.com
Mon Mar 24 12:43:20 PDT 2008
On 24/03/2008, Walter Bright <newshound1 at digitalmars.com> wrote:
>
> T foo(return T t);
Actually, I do find that confusing, because any return statement
inside the body of the function would have to return a const(T), not a
T. Watch:
T foo(return T t)
{
T u = t; /* Whoops - won't compile */
const(T) u = t; /* OK */
return u;
}
It would be less confusing if it were declared as
const(T) foo(return T t)
More information about the Digitalmars-d
mailing list