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

it feels like Python without any of its drawbacks

Uses whitespace for code blocks though. I figured we've moved past that.

  • source
  • hideshow 21 child comments
  • [–] [S] 11 points 1 year ago (10 children)

    I don't get the hate for whitespace personally. It was maybe an issue 15 years ago, but modern code editors easily solve its issues. You can collapse whitespace blocks, the editor can automatically replace spaces with tabs, etc.

  • source
  • parent
  • hideshow 10 child comments
  • [–] 7 points 1 year ago (9 children)

    It solved a problem that didn't exist and created problems that hadn't previously existed.

    There's a reason every python "intro" begins with "spend 20 minutes setting up an editor to deal with whitespace" properly.

    It makes moving code harder. It makes jumping around code blocks harder. Often the ide can help but sometimes it can't.

    In any curly-brace language these are things I simply don't need to even think about. But in Python it's a pain.

    Yes it's not the end of the world. Yes I can spend hours fine-tuning my editor. But.... Why should I even have to? Why create these hurdles for no gain?

  • source
  • parent
  • hideshow 9 child comments
  • [–] 8 points 1 year ago*

    No clue what you're talking about honestly. I've worked on a 7 million line python codebase, and while python had tons of issues, whitespace was not one of them. You can easily move things around and have never seen a bug due to bad indentation.

  • source
  • parent
  • [–] 3 points 1 year ago (6 children)

    I spend a huge amount of time working with Python and regularly do things like refactoring and do not run into all of this pain that supposedly exists, and never have. I think that you should stop speaking on behalf of "everyone".

  • source
  • parent
  • hideshow 6 child comments
  • [+] -8 points 1 year ago (5 children)

    I'm not speaking for everyone. Just everyone with taste.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 1 point 1 year ago (3 children)

    More like everyone whose text editor is apparently Notepad...

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

    The best argument I've heard for whitespace blocking is "it's not that bad when you get your text editor configured". That's an excuse, not a reason.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 year ago*

    Idk know what editor you're using, but it worked perfectly fine out of the box with IntelliJ. Nothing compared to the hassle of setting up a proper Eslint setup for typescript, honestly.

    And I'm not trying to defend python here, I don't touch that language except under duress, and I do prefer C-style code blocks as well. But this is kind of a pointless argument.

  • source
  • parent
  • [–] 5 points 1 year ago (8 children)

    I thought we moved past that complaint 20 years ago. It’s not as if you won’t indent your code anyway.

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

    We moved past it because everone realized it was a stupid idea. Rust, go, etc abandoned it and rightly so. It causes more problems than it's worth.

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

    A more fundamental difference between Rust and Python is essentially that the former is expression-based whereas the latter is statement-based, so arguably you need delimiters for code blocks in Rust because an expression can contain a block that itself has statements in it, whereas there is (sadly) no equivalent in Python. (Having said that, even if this weren't the case, it would probably still have used curly braces for delimiters because it wants to look a bit like C++ to make it more palatable for that group, not because deep wisdom was involved.)

    There are lots of things to not like about Python, but the lack of curly brackets that would just be redundant anyway is not one of them. You hardly alone in your opinion, but you are not speaking for "everyone" either.

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

    I deal with the syntax on a daily basis though. Moving code around is objectively more difficult with Python since IDEs can't always know where the block should be tabbed to. Sometimes it is correct at guessing, sometimes not. And when it's not all I can think of is "why the fuck am I dealing with this?". It's a non-issue in proper languages. Just simply doesn't exist. The IDE there can know where things should be tabbed to. It's a problem created explicitly by the language syntax.

  • source
  • parent
  • hideshow 1 child comment
  • [–] -1 points 1 year ago (3 children)

    Meanwhile, Python is one of the most widely used programming languages.

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

    If a zillion people do a silly thing, it's still a silly thing.

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

    The point is it's a dumb, old argument that apparently hasn't affected adoption of the language. Python is immensely useful and significant whitespace is a big, fat nothingburger. It's just silly to still be debating it after all these years. The time for that was like 30 years ago.

  • source
  • parent
  • hideshow 1 child comment
  • Yeah, it's like going to a restaurant and only judging the food by the restaurant's decor. It is arguing something that doesn't matter and most people get over it after they've worked in a number of languages.

    It just doesn't matter and instead adds noise to the language feedback loop for something that isn't changing and isn't a problem to begin with.

  • source
  • parent