No, precisely the case when two replacements would apply (e.g. replace("aabb", "aa" => "c", "aabb" => "d")
) is ambigous. There is no “simultaneous application” where both replacements are done at the same time. The order matters, and as such you have to choose. There is no quantum superposition of resulting states.
I was referring to one of your comments in the thread you linked.
I’m certainly not arguing in “bad faith” here, I’ve just come to a different conclusion based on personal preference. No solution is arguably better than any other here, and as such it should be left to the user to decide how they want this to behave on Strings in their particular case. (As an aside, my personal preference would be that people wrap strings and define replace
however they want on their own type. This would also help enforce the invariants that are often expected of things that look like strings but often aren’t, like e.g. filepaths are).
Please do! I’d be interested as well, especially in their reasoning for choosing one implementation over another or how users responded to their implementation.