3 ms·
Totally not relevant for this post, but this is how we do this in Nim: const a = readFile("mydata") The `const` makes the expression evaluate at compile t
by zevv 6y ago
Totally not relevant for this post, but this is how we do this in Nim:
const a = readFile("mydata")
The `const` makes the expression evaluate at compile time, conveniently slurping the file into `a`, where it will be available at run time.
- mikepurvis 6y agoThat is pretty cool, but also not the behaviour I'd expect coming from other languages where this would be "get the contents of this file from the current directory of my runtime environment, and assign them to immutable variable `a`."
- zevv 6y agoUnderstandable; there's `let` for run time and `const` for compile time evaluation.