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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 16 20:09:12 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=1985

--- Comment #10 from hsteoh at quickfur.ath.cx ---
The compiler has no way to know whether an imported file is even text to begin
with. For all you know, the code could be:

````
auto logo = import("logo.png"); // embed image inside executable
````

It's not the compiler's job to decode the contents of arbitrary files. Let
import(filename) return ubyte[], and let the user code decide what to do with
it.

--


More information about the Digitalmars-d-bugs mailing list