dmd/changelog/dmd.import-exp-hexstring.dd
2024-07-01 01:21:36 +02:00

12 lines
535 B
Text

Import expressions are now treated as hex strings
While [Import expressions](https://dlang.org/spec/expression.html#import_expressions) are typed as `string`, they are also used to embed binary files.
By treating them the same as hex strings, they will implicitly convert to arrays of integral types other than `char`.
---
// Formerly, a cast was required:
immutable ubyte[] iconImg = cast(immutable ubyte[]) import("icon.png");
// Now, it implicitly converts to integral arrays:
immutable ubyte[] iconImg = import("icon.png");
---