missing HexString documentation

Steven Schveighoffer schveiguy at yahoo.com
Thu Feb 8 15:07:33 UTC 2018


On 2/8/18 9:44 AM, Adam D. Ruppe wrote:
> On Thursday, 8 February 2018 at 13:06:44 UTC, Steven Schveighoffer wrote:
>> So you think it should go into druntime? I don't see why it wasn't in 
>> there in the first place to be honest.
> 
> Yeah, probably. I might even publically import it when you import the 
> posix header so it just works in the most common place.
> 
> Of course, it is important then that the compile-time thing doesn't 
> cause a link time error when you just import and don't compile it in.... 
> but that should be the case anyway (and the other posts in this thread 
> show Walter is working on that so yay)
> 
>> If you could have imported std.conv in druntime, it would have been done.
> 
> That's my point. We keep clashing despite being on the same side!

Your statement before: "it is 0o100 vs import std.conv" and "That is why 
it isn't used in druntime" I thought it meant there was some sort of 
decision made to not use the import because it would be too costly. But 
really, there was no decision to be made.

Sorry about the misunderstanding!

> When I say the import is the problem, I don't mean the syntax or literal 
> line of code. I mean the whole concept of depending on the Phobos module 
> and all the stuff that brings. druntime can't have that dependency. 
> Neither can a few other specialized low-level cases. And specialized 
> low-level cases are where you find 95% of octal literals. (well ok 50% 
> of octal literals, where the other 50% are bugs cuz someone wrote 010 to 
> line up leading zeros... )

I agree, you could implement the octal template in druntime without too 
much issue. The octal!"100" would have been easy-to-parse, the octal!100 
version would be more difficult, but nothing impossible that requires 
the whole of phobos to do so.

My concern in the hexString case is the sheer requirement of CTFE for 
something that is so easy to do in the compiler, already *done* in the 
compiler, and has another form specifically for hex strings (the 
"\xde\xad\xbe\xef" form) that isn't going away. It makes me laugh 
actually that Walter is now replacing the implementation with a mixin of 
that other form, incurring all the cost of CTFE so you can transform the 
string, while breaking existing code in the process: 
https://github.com/dlang/phobos/pull/6138

-Steve


More information about the Digitalmars-d mailing list