transporting qualifier from parameter to the return value

Michel Fortin michel.fortin at michelf.com
Wed Dec 16 05:48:31 PST 2009


On 2009-12-15 22:02:59 -0500, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Time has come to make a decision on implementing Steven Schveighoffer's 
> proposal:
> 
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP2
> 
> It's been in the back of my mind for a while now, I don't find a fault 
> with it, it solves a very unpleasant problem that would seriously mar 
> qualifiers, and although it doesn't solve 100% of the potential cases, 
> it does solve a good fraction of them. I am confident that we can 
> require body duplication for the remaining stragglers with a straight 
> face.

I just realized that 'inout' could have a real use even for functions 
with no return value. Consider this:

	void doSomething(inout(Object)[] a, inout(Object)[] b) {
		a[0] = b[0]; // works only when objects in both arrays have the same 
constness.
	}


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list