Why can't compile time expressions do ___?
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Feb 6 14:19:53 PST 2016
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.
More information about the Digitalmars-d-learn
mailing list