From 782ac7b9f1e856fa5559aa91d5217fe62f19054c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 19 Jul 2018 22:05:51 +0200 Subject: [PATCH] clarify a bit the I/O story --- ralf/_posts/2018-07-19-const.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ralf/_posts/2018-07-19-const.md b/ralf/_posts/2018-07-19-const.md index da18fc1..5907630 100644 --- a/ralf/_posts/2018-07-19-const.md +++ b/ralf/_posts/2018-07-19-const.md @@ -34,7 +34,10 @@ We say that the `3 + 4` above is in *const context* and hence subject to CTFE, b Not all operations can be used in const context. For example, it makes no sense to compute your array length as "please go read that file from disk and compute something" -- we can't know what will be on the disk when the program actually runs. We could use the disk of the machine compiling the program, but that does not sound very appearling either. -In fact, it would also be grossly unsafe: +Things get even worse when you consider letting the program send information to the network. +Clearly, we don't want CTFE to have actually observable side-effects outside of compilation. + +In fact, just naively letting programs read files would also be grossly unsafe: When computing the length of an array twice, it is important that we obtain the same result. > *CTFE must be deterministic.* -- 2.30.2