Re:Ownership and Borrowing in D
by EvenThisAcronym on Tuesday July 16, 2019 @03:50PM
(#20453277)
> This is different from being able to walk a directory and read random files.
D doesn't allow you to do that either. You have to specify what files you are importing via a compiler switch: https://dlang.org/spec/expression.html#import_expressions
Re:Ownership and Borrowing in D
by WalterBright on Tuesday July 16, 2019 @04:31PM
(#20453591)
Yes. That's another barrier I put in to prevent a carefully crafted source code from being a malware vector.
It’s not directly part of the const function, but rust has compiler built-ins to import files as values as compile time, which makes it easy to declare global static variables that contain that data.
This is different from being able to walk a directory and read random files.
https://doc.rust-lang.org/std/macro.include_str.html
https://doc.rust-lang.org/std/macro.include_bytes.html
> They share the same frontend so there is very little difference.
That’s excellent.