Is there any constant variable or proc
that allows to access the compiler version as a string or number?
Nim source code can also be compiled into Objective C and JavaScript. The Objective C language is mainly used for iOS software development; by compiling to it, you can write iOS applications natively in Nim. You can also use Nim to develop Android applications by using the C++ compilation backend.
The Nim compiler supports mainly two backend families: the C, C++ and Objective-C targets and the JavaScript target. The C like targets creates source files that can be compiled into a library or a final executable. The JavaScript target can generate a .
To see all compiler options, type nim --help in your terminal. If you're using VSCode with the Code Runner extension mentioned before, you'll just have to press Ctrl+Alt+N and your file will be compiled and run.
Introduction. nlvm (the nim-level virtual machine?) is an LLVM-based compiler for the Nim language. From Nim's point of view, it's a backend just like C or JavaScript - from LLVM's point of view, it's a language frontend that emits IR.
The version can be obtained as a string via system.NimVersion
(remember that system
is implicitly imported):
echo NimVersion # 0.18.0
You can also access its component parts (MAJOR.MINOR.PATCH) as numbers like so:
echo NimMajor # 0
echo NimMinor # 18
echo NimPatch # 0
This makes checking versions for compatibility very easy when combined with tuples:
when (NimMajor, NimMinor, NimPatch) >= (0, 19, 0):
echo "we're on at least Nim v0.19.0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With