any news on const/invariant?

Walter Bright newshound1 at digitalmars.com
Tue Nov 27 10:59:47 PST 2007


Bill Baxter wrote:
> I agree.  I don't get why we need two ways to express it.  What's the 
> benefit of writing const out in front?

1. It's semantically consistent.

2. It enables you to 'group' const member functions:

const
{
     int foo();
     int bar();
}

this cleans up things nicely when you have a number of member functions. 
Contrast this with how the same code looks in C++.



More information about the Digitalmars-d mailing list