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
[–] 5 points 1 year ago (5 children)

Apparently, past-me wasn't as big on the syntax. 😅

You were right. Using whitespace for code blocks is literally the worst option.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 8 points 1 year ago (4 children)

    I dunno I would say Lisp syntax is probably the worst option. Or APL style.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 4 points 1 year ago (2 children)

    Lisp syntax would not even necessarily be that bad if in practice people did not lump all of the closing parentheses in a place where it is really hard to visually match them with their respective opening parentheses so that it is hard to immediately see what is going on. (I have been told that the trick is to read the whitespace instead of the parentheses, but that does not actually help because the whitespace is not significant in Lisp!)

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 year ago (1 child)

    Yeah I agree. Presumably they don't do that though because you'd end up with pages of nothing but ).

    I never understood why they don't add just a little syntactic sugar. You don't need much to take it from a mess of brackets to something comprehensible.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 year ago

    I never understood why they don't add just a little syntactic sugar. You don't need much to take it from a mess of brackets to something comprehensible.

    It was in the original design, but not the first implementation. By the time someone got around to it, people where used to S-expressions.

  • source
  • parent