From: Ralf Jung Date: Thu, 19 Jul 2018 20:05:51 +0000 (+0200) Subject: clarify a bit the I/O story X-Git-Url: https://git.ralfj.de/web.git/commitdiff_plain/782ac7b9f1e856fa5559aa91d5217fe62f19054c?ds=inline;hp=86c3fec9d8b417f13aa70c1b32ebc67fefc38317 clarify a bit the I/O story --- 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.*