Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
[arnetheduck@tempus tmp]$ nim c -r --hints:off testit
inTestit2: 0
inTestit2: 3
3
[arnetheduck@tempus tmp]$ nim --version
Nim Compiler Version 1.4.2 [Linux: amd64]
Compiled at 2020-11-30
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: 3fb5157ab1b666a5a5c34efde0f357a82d433d04
active boot switches: -d:release
notice how the first time around x has not had its initializer run yet. Of course, these kinds of circular inits are not sound, but the compiler should be able to detect them and ideally prevent them.
testit2:
testit:
notice how the first time around
x
has not had its initializer run yet. Of course, these kinds of circular inits are not sound, but the compiler should be able to detect them and ideally prevent them.