COW vs. in-place.

renox renosky at free.fr
Thu Aug 3 13:47:19 PDT 2006


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.

In ruby, they have this nice convention that a.function() leaves a 
unchanged and a.function!() modifies a.

Something like this would be nice, the hard part is choosing the correct 
naming convention so that it is followed..

functionXIP (eXecute In Place), functionWSD (With Side Effect)?
Sigh, hard to achieve something as simple and elegant as '!' : caution 
this function modifies the object!

In the absence of proper naming termination, an optionnal parameter 
could be used yes.

Regards,
Renaud Hebert


> 
> Thanks,
> 
> - Dave



More information about the Digitalmars-d mailing list