COW vs. in-place.
Regan Heath
regan at netwin.co.nz
Wed Aug 2 16:50:31 PDT 2006
On Mon, 31 Jul 2006 11:18:40 -0500, Dave <Dave_member at pathlink.com> 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.
I think it's the right idea, but I think it's simply a variation of the
idea that the array itself needs a flag to tell functions whether they
have to copy, or can modify in place. A 'readonly' flag, as mentioned here
in other threads.
I'd prefer the flag was internal to the array so that my function
signatures were simpler and less cluttered by things not directly related
to the function.
That said, your idea can be implemented right now. The internal array flag
requires Walter to agree and change D's arrays.
Regan
More information about the Digitalmars-d
mailing list