mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
12 lines
559 B
Text
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");
|
|
---
|