On Thursday, 16 March 2017 at 16:21:08 UTC, Adam D. Ruppe wrote:
On Thursday, 16 March 2017 at 16:13:33 UTC, Carl Sturtivant
wrote:
string ans = md5Of(arg).toHexString();
That is a major D design flaw biting you the same way it has
bitten so many others.
See the red box in my documentation fork:
http://dpldocs.info/experimental-docs/std.digest.digest.toHexString.2.html
toHexString returns a static array... on the stack. Then the
stupid language not only implicitly casts it to immutable, it
also implicitly slices it, giving you a reference to mutable,
temporary data pretending to be permanent, immutable data.
Silently <expletive-deleted> cast to immutable without
copying!??!! This is so wrong.
Yet the documentation says there's a toHexString that returns a
string.
http://dlang.org/phobos/std_digest_digest.html#.toHexString
I don't understand the overload resolution implied at this link.
How is a toHexString selected in
string ans = md5Of(arg).toHexString();
?