What am I missin with const?

monarch_dodra monarchdodra at gmail.com
Tue Jan 29 02:16:37 PST 2013


On Tuesday, 29 January 2013 at 09:50:37 UTC, bearophile wrote:
> deadalnix:
>
>> Well I think the error message you propose isn't possible as 
>> it would cause many problems in generic code.
>
> Please, add one or two of such troubled cases in the issue 
> thread:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=9422
>
> Bye,
> bearophile

For what it's worth, I think 9422 is better than 4070. You rarely 
see const on the return type without also putting it on the 
function too, so this should catch *most* accidental usage.

It also still allows the syntax for those that enjoy qualifying 
everything on the previous line:
//----
pure @property @safe const
int foo()
{
     ......
}
//----


More information about the Digitalmars-d mailing list