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
  • Peereboominc@piefed.social
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    1 month ago

    I have no idea about Nim but have you checked Go (Golang)? It does the things that you need: single binary, cross compile, easy to learn (except methods on an object are a bit weird at first).

    Next to that it is also stable, not dying soon and lots of dependencies to extend the language.

    Anyway, if you like Nim, go for it.

    • popcar2@programming.devOP
      link
      fedilink
      arrow-up
      3
      ·
      1 month ago

      Go would probably be my 2nd choice. I haven’t used it much but my initial impression was that it felt kind of boring to write with, and a hello world would end up being a ~2mb binary which put me off a bit. I could give it another shot in the future, but I’m busy enjoying Nim so that probably won’t be any time soon.