[Issue 1985] import expression should return ubyte[] not string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 3 11:56:47 UTC 2021


--- Comment #16 from Mike Parker <aldacron at gmail.com> ---
Using 'representation' is not a workaround, anymore than would be converting a
`ubyte[]` to a string. No matter what the expression returns, it will need to
be converted to the format you need it in if that isn't the one you get.

And I have no idea how often it's used in the wild. But it's been the way it is
for years and it seems arbitrary to change it now. Given that we have a way to
easily get a `ubyte[]` from it, I just don't see that changing its behavior is
worth the potential breakage.

I do agree that an array of bytes would be more sensible, but I just think that
ship has sailed. What would be interesting would be to enhance it such that a
type can be specified as part of the expression. Maybe something like
`import("foo.png", ubyte[])`.


More information about the Digitalmars-d-bugs mailing list