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/9bf52f555d410cd822a0479a85fe3e73d3203260?ds=sidebyside clarify a bit the I/O story --- diff --git a/personal/_posts/2018-07-19-const.md b/personal/_posts/2018-07-19-const.md index da18fc1..5907630 100644 --- a/personal/_posts/2018-07-19-const.md +++ b/personal/_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.*