Proposal for scoped const contracts

Oliver Dathe o.dathe at
Tue Mar 25 14:24:57 PDT 2008

Janice Caron wrote:
>>      char[] f(char[] p : const(char)[]) { }
> I don't think I'd like to have to specify the type twice for every
> affected parameter.

I'm pretty sure, that most of the time you could stick with some 
shorthand version like

     char[] f(char[] p const) { } // or
     char[] f(char[] p : const) { }

However, it seems like the leading problem is to bring the const level 
of parameters to the return type in an appropriate, expressive way. I 
think that is solved in 90% of the time with

     char[] f(return char[] p const) { }

Not yet sure if that is satisfying enough.

More information about the Digitalmars-d mailing list