[Issue 1985] import expression should return ubyte[] not string
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Aug 3 11:38:47 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=1985
--- Comment #15 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Mike Parker from comment #14)
> This gets at the bytes, does it not?
>
> enum bytes = import("foo.png").representation;
Sure. But it only works because DMD happily creates an invalid string from
`import("foo.png")` which is unusable unless reinterpreted. Arguably, it should
throw an error instead.
> I don't think we should change the behavior of the import expression at this
> point when the above achieves the same result.
Having a workaround is not a reason to keep the current behavior.
The one argument for not addressing the issue as requested is breakage. If the
type of `import(...)` is changed to ubyte[], the current uses will have to be
updated. But if RazvanN's assertion that the feature isn't being used all that
much is correct, then breakage doesn't matter all that much, does it?
--
More information about the Digitalmars-d-bugs
mailing list