std.digest toHexString

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 16 10:06:39 PDT 2017


On Thursday, 16 March 2017 at 16:46:43 UTC, H. S. Teoh wrote:
> 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?

Yeah, somewhere, bugzilla search sucks but I know it is in there 
somewhere. We've talked about it at some length, including JMD 
and I recently on github relating to the Phobos template 
constraint mess: 
https://github.com/dlang/phobos/pull/5259#issuecomment-285445535

He said Walter thinks one of those memory safety DIPs will moot 
it, but I completely disagree. Even if this code threw an error 
(which it ABSOLUTELY SHOULD for several reasons), the implicit 
slice still leads to convoluted Phobos constraints to deal with 
it sanely! (Well, IMO the sane option is to just disallow it in 
the constraint, but ohes noes teh broken c0dez)

In isolation, implicit slicing can make sense.... but not with 
templates. In isolation, implicit immutable can make sense... but 
not with implicit slicing.

We aren't getting rid of templates. They are useful. But implicit 
slicing? Please, just write `[]` if you want that, easy fix, and 
then we'd rescue the immutable cast too.


More information about the Digitalmars-d-learn mailing list