Re:Nim: Scripting Ease in a Compiled Language
by qwerty456127 on Tuesday October 29, 2019 @08:27PM
(#21393516)
Looks cool already but is it easy to cross-compile? I can copy a Python script from my Linux machine and run it on both Mac and Windows PCs. Can Nim build executables for other platforms nearly as easy?
[ Parent
| on HN ]
Re:Nim: Scripting Ease in a Compiled Language
by creatornator on Tuesday October 29, 2019 @09:05PM
(#21393708)
In addition to compiler switches that allow you to cross compile from the nim compiler [0], you can compile to c or c++, and then invoke whatever cross-compilation toolchain to compile to more esoteric platforms.
Re:Nim: Scripting Ease in a Compiled Language
by uvtc on Tuesday October 29, 2019 @10:04PM
(#21393996)
If cross-compilation is important to you, and you like Nim's level of abstraction, you might have a look at Haxe, which can compile to [lots of different targets](https://haxe.org/documentation/introduction/compiler-targets...).
Re:Nim: Scripting Ease in a Compiled Language
by iffycan on Tuesday October 29, 2019 @11:05PM
(#21394334)
Yes! I use Nim on macOS to build a Windows exe for bootstrapping a Windows VM. A year ago, you had to dig a little to figure out the right command line incantation, but maybe it's better now.
Re:Nim: Scripting Ease in a Compiled Language
by bloblaw on Tuesday October 29, 2019 @08:42PM
(#21393590)
Well, you sorta can. As long as you wrote it:
* to work in both Python 2 and 3 (no telling what other system's Python will be) * don't use any modules outside of stdlib (that requires install too)
Those aren't always requirements, but they are the reason I reach for compiled languages when I can't control the target environment where the program needs to run (or don't want to).