On Friday, 2 August 2013 at 08:46:18 UTC, monarch_dodra wrote:
Without doing this, you face the eternal problem: Should I
return a "string", to give my end user more guarantees, when in
fact my char array is perfectly mutable, or should I return a
char[], forcing my end user to make an idup(or an unsafe cast)
if he actually needed a string?
It's a tough problem to tackle.
The solution has been posted to this newsgroup already in form of
unique/unaliased types. Thats THE selling point for them.
If you have an array of char and it could be char[] as well as
string, than let the type system infer the right one for you.