Hacker News new | ask | show | jobs
by flykespice 16 days ago
I have been eyeing nim for a while though I'm more used to curly-braced language families.

The first thing I evaluate in a language is how it looks like in production code, and the samples in github strikes me odd -- like most of the code identation is 2-space and no line break between variable declaration and other groups of statement (everything is lumped together).

Just check https://github.com/WyattBlue/auto-editor/blob/master/src/wav... to have an idea of what I'm talking about. Is that how normal nim code supposed to look like? (following its best practices)

2 comments

2-spaces is the norm. The line break style varies a little more, but your example doesn't look out of place to me as someone who uses nim a lot for personal projects and Python for my day job.

Here's an example in a popular Python library that feels stylistically similar to the one you gave: https://github.com/pallets/flask/blob/main/src/flask/app.py#...

I think it's just cultural shock. Because it's hard to distinguish nestings with 2-spaces for someone like me used to TAB identations, and they had good reason to stick with it.

> Here's an example in a popular Python library that feels stylistically similar to the one you gave: https://github.com/pallets/flask/blob/main/src/flask/app.py#...

Tbh, the example code you gave me is much more tidied up with clear separation between logical groups of statement and some comments sprawled around to guide on the control flow.

yeah, for me it is fine.

Personally I tend to abuse UFCS, but I use the same style (maybe more breaks).