On Wednesday, 7 February 2018 at 16:03:36 UTC, Steven Schveighoffer wrote:

They are deprecated:

https://dlang.org/changelog/pending.html#hexstrings
https://dlang.org/deprecate.html#Hexstring%20literals

Wow, that's... a little superfluous.

I agree with the notion that the language should be an aggregate of primitives, and anything that can be composed of those primitives should be implemented in a library (unless a compelling reason is found to justify otherwise). The deprecation of hex string literals has exposed flaws in the library implementation and the compiler's template implementation. That doesn't mean deprecation was the wrong thing to do; it just brings the aforementioned flaws to the forefront, so let's not shoot the messenger.

Here's a few fundamental flaws I see in our library implementations. * Some library implementations are not very cohesive, and have too many interdependencies. This is what seems to prevent `HexString` from being used in -betterC. * Some Phobos implementations would be quite useful in Druntime and in code that doesn't want to employ the runtime (e.g. libraries consumed by other languages, resource-constrained systems, and bare-metal programming), but alas, Druntime can't have a circular dependency on Phobos (nor should it).

This is a difficult problem, and I don't have any solutions; just ideas. Maybe Phobos and Druntime should be divided into 3 libraries:

1. A library with no dependencies whatsoever, not even druntime, c runtime, or the C standard library. Some stuff in `std.traits`, `std.conv`, and even `HexString` could go here. Let's call this library DLib. 2. Druntime would only depend on DLib, but never publicly expose it. 3. Phobos could depend on DLib or Druntime, but again, never publicly expose it. 4. Phobos could be refactored by identifying packages that have too much coupling, and factoring out the dependencies into a 3rd, more cohesive library, imported by the previous two.

For extra credit:
2a. Move C/C++ standard library bindings to Deimos, and have the desktop OS ports import it privately. There's no reason to impose this interface on bare-metal ports, and it's a superficial dependency anyway. 3a. Phobos shouldn't have any dependency on C/C++ language bindings. DRuntime should expose an idiomatic D (and preferably @safe) interface for Phobos to use.

DLib could then be used in -betterC and other use cases where Druntime is more of a liability than an asset.

Mike


Reply via email to