C++

BCS BCS at pathlink.com
Fri Jun 30 16:07:25 PDT 2006


Tony wrote:
> 
> 
> I too agree.  Making const the default and adding a mutable keyword would be 
> wonderful.  This would more than address what seems to be one of the primary 
> (and I think quite justified) criticisms of D by the C++ community.
> 
[...]

This would only apply to reference types I assume. So, when giving away 
a reference, would one have to grant mutability privilege any time the 
recipient doesn't ensure non-mutation?

If this is the case, I would advocate the use of an operator for this, 
something with a syntax like the address of (&) operator, maybe the "@".



void func(mute char[] arg)
{
	foreach(inout a;arg) a='\0';
}

...
char[] foo;

func(@foo);	// valid
func(foo);	// error: argument 1 of "func" is mutable
...



More information about the Digitalmars-d mailing list