transporting qualifier from parameter to the return value

Denis Koroskin 2korden at gmail.com
Wed Dec 16 05:54:03 PST 2009


On Wed, 16 Dec 2009 16:48:31 +0300, Michel Fortin  
<michel.fortin at michelf.com> wrote:

> 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.
> 	}
>
>

Doesn't work.

doSomething("hello", "world");



More information about the Digitalmars-d mailing list