Const: what do you want to achieve (proposition...)?

Bruce Adams tortoise_74 at yeah.who.co.uk
Tue Nov 13 08:16:08 PST 2007


Janice Caron Wrote:

> On Nov 13, 2007 10:03 AM, Gilles G. <schaouette at free.fr> wrote:
> > So, what do you think?
> 
> It doesn't distinguish between const and invariant.
> 
> If the function is a member function, it doesn't tell me if the class
> instance (this) will be modified.
> 
> But apart from that, I kinda like it. Of course, there have been
> various requests for const-by-default in the past (including from me),
> and also various requests for multiple return values (although I
> believe we can do that now, with a slightly different syntax, using
> value tuples), so I'd say the proposition has arisen before. (Just,
> maybe not all at once). It's unlikely to happen though.

Walter has 90% of (an) answer up his sleeve so this is all moot.
But if the default behaviour was const you could have

foofunc(bar barValue);  //const 
foofunc(inout bar barValue); //non-const because barValue is also an output.

Doesn't solve the invariant problem though.




More information about the Digitalmars-d mailing list