xxxInPlace or xxxCopy?
bearophile
bearophileHUGS at lycos.com
Thu Jan 20 09:53:21 PST 2011
so:
> I don't understand how the first two are clear and the last two are not so.
> Where both have the name "replace" for different things, and replace to me
> means "replace in place".
> With this in hand, how is the first "replace" is quite clear?
In Python I am used to immutable strings, so string methods like replace return a modified copy. D1 string functions are similar. I'd like D2 to be like Python here, but in practice an in-place replace procedure and a strongly-pure replace function that returns a modified copy are about equally clear :-) Yet, if you perform many in-place operations on strings you may get confused (it happened to me), such confusion is less common with functional-style string functions.
Bye,
bearophile
More information about the Digitalmars-d
mailing list