I've been researching programming languages to find a good, high level language that compiles to a single binary that is preferably pretty small. After tons of research, I landed on Nim and used it to make a quick txt parser for a project I'm doing.

Nim seems absolutely fantastic. Despite being sold as a systems programming language, it feels like Python without any of its drawbacks (it's fast, statically typed, etc.) - and the text parser I made is only a 50kb binary!

Has anyone here tried Nim? What's your experience with it? Are there any hidden downsides aside from being kinda unpopular?


Bonus: I want to give a shoutout to how easy it is to open a text file and parse it line-by-line in this language. Look at how simple and elegant this syntax is:

import os

if paramCount() == 0:
  quit("No file given as argument", 1)

let filepath = paramStr(1)

if not fileExists(filepath):
  quit("File not found: " & filepath, 1)

for line in lines(filepath):
  echo line
you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 1 year ago (2 children)

How is compiling Nim binaries compared to Python? I know on Python, the most common choice is PyInstaller, but that only compiles binaries for the type of system it is executed on.

  • source
  • hideshow 2 child comments
  • [–] 6 points 1 year ago* (last edited 1 year ago)

    Nim is a compiled language by default, and supposedly cross-compilation is usually as simple as

    apt install mingw-w64
    nim c -d:mingw myproject.nim
    

    though I haven't really tried doing it (and my general impression of nim is anything "slightly obscure" like cross-compilation still has a non-zero risk of running into unexpected thorny bugs)

  • source
  • parent