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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 3 10:41:45 UTC 2021


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #13 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to RazvanN from comment #12)
> 1. The primary purpose of the import keyword is to import other modules.
> Since its meaning is tied to importing text files, it makes sense to return
> a string. If you want to read files of arbitrary types, std.file.read should
> be used.

`import ...;` isn't tied to text files in any meaningful way. It imports a
module, which may or may not be stored as text. It doesn't yield a string.

std.file.read cannot be used during compilation like `import(...)`.


> 2. This particular semantic of the import keyword is not widely spread. I,
> personally, have never seen it in any of the D projects that I contributed
> to.

I don't think you personally using a feature is a good metric for accepting
issues.

--


More information about the Digitalmars-d-bugs mailing list