3 ms·
D has something like type-safe printf. You can pass the printf string as a compiletime parameter, so ie. format!`%s is bigger than %s`(2, 3, 4) will error durin
by FeepingCreature 8y ago
D has something like type-safe printf. You can pass the printf string as a compiletime parameter, so ie. format!`%s is bigger than %s`(2, 3, 4) will error during compilation.
- ben-schaaf 8y agoIt also has similar type safety for native to `byte[]` conversion, ie. `bigEndianToNative!int` takes a `byte[4]`, which you can pass in from a `byte[]` using `data[0..4]`.
- icebraining 8y agoThe question is whether that's a special case of the compiler or if it can be implemented by regular D code.
- FeepingCreature 8y agoIt is implemented by regular D code in std.format. Logging libraries often do the same thing.