Ali Çehreli: > char[] result = foo(); > string immutable_result = assumeUnique(result); > > But that's the wrong thing to do, as foo() may be changed in the future > to return a non-unique result.
I think assumeUnique is meant to be used inside foo(), at its end. Somewhere in Bugzilla (I don't remember the number, sorry, suggestions welcome) there is a bug report (that I think Walter has vaguely accepted, but it's not implemented yet) that asks results of pure functions to be implicitly cast-able to immutable. This surely doesn't solve the whole situation, but it's a start, and it's a simple but useful thing. Bye, bearophile
