dmd/changelog/dmd.import-exp-hexstring.dd
2025-02-14 08:23:16 +08:00

12 lines
559 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](https://dlang.org/spec/lex.html#hex_strings), they implicitly convert to arrays of integral types.
---
// 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");
---