COW vs. in-place.

Dave Dave_member at pathlink.com
Wed Aug 2 18:38:47 PDT 2006


Sean Kelly wrote:
> Dave wrote:
>>
>> What if selected functions in phobos were modified to take an optional 
>> parameter that specified COW or in-place? The default for each would 
>> be whatever they do now.
>>
>> For example, toupper and tolower?
>>
>> How many times have we seen something like this:
>>
>> str = toupper(str); // or equivalent in another language.
> 
> Why not:
> 
>     str = toupper(str);     // in-place
>     str = toupper(str.dup); // COW
> 

That's how I think things should be, but it might break a lot of code now <g>

> or alternately:
> 
>     char[] toupper(char[] src, char[] dst = null);
> 
> where dst is an optional destination argument.
> 
> 
> Sean



More information about the Digitalmars-d mailing list