On Thu, Mar 16, 2017 at 04:21:08PM +0000, Adam D. Ruppe via Digitalmars-d-learn 
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.

WAT?!  Why does the language allow implicitly casting from static array
to string?!  How is that even remotely correct?  Is there a bug filed
for this?


T

-- 
To provoke is to call someone stupid; to argue is to call each other stupid.

Reply via email to