February 06, 2016 Why can't compile time expressions do ___? | ||||
---|---|---|---|---|
| ||||
I'm not clear on why you aren't allowed to allocate memory with compile time execution, or why access to the filesystem is restricted. (Unless you pass -J/ I think?) |
February 06, 2016 Re: Why can't compile time expressions do ___? | ||||
---|---|---|---|---|
| ||||
Posted in reply to cy | On Saturday, 6 February 2016 at 22:13:55 UTC, cy wrote: > I'm not clear on why you aren't allowed to allocate memory with compile time execution You can... use the built-in new operator or arrays, etc. > or why access to the filesystem is restricted. (Unless you pass -J/ I think?) CTFE is a "pure" environment, it is supposed to only depend on the code and passed compile options (which may indeed include a path with -J that you are allowed to read files from). It doesn't actually run a complete program on the installed computer / OS, it just does some computations. This is meant to be a security thing (which IMO is dubious) and a platform issue: D code can be compiled independently of an operating system. |
Copyright © 1999-2021 by the D Language Foundation