Peter Me
peterme.net · Personal blog · on HN since 2018
Peter, a developer who writes about the Nim language, covering async, metaprogramming, C library wrapping, and error handling.
What HN saysHN commenters link it as an example of what someone is building with Nim, including its metaprogramming and custom syntax.
15HN people shared it
4linked it in comments
20stories submitted
123story points
2 months agolast shared
2018people per year2026
Most-shared posts
- 1Asynchronous Programming in Nim2 people · 9 points · first shared 2021 · 2 comments on HN
- 2Nim at FOSDEM – frequently asked questions (2018)2 people · 6 points · first shared 2018 · discussion on HN
- 32019: Tips and tricks with implicit return in Nim2 people · 3 points · first shared 2023 · discussion on HN
- 4Labelled exceptions for smoother error handling (2023)2 people · 3 points · first shared 2023 · discussion on HN
- 5Wrapping C libraries in Nim (2023)2 people · 2 points · first shared 2023 · discussion on HN
- 6Dynamic Libraries in Nim2 people · 1 points · first shared 2023 · discussion on HN
- 7Cross platform guis and nim macros2 people · first shared 2019
- 8Metaprogramming and read and maintainability in nim2 people · first shared 2019
- 9Is Nim a Transpiler?1 people · 44 points · first shared 2021 · 70 comments on HN
- 10Optional Value Handling in Nim1 people · 43 points · first shared 2021 · 24 comments on HN
- 11Building an epaper laptop: the monitor1 people · 3 points · first shared 2025 · discussion on HN
- 12Nim Q&A1 people · 2 points · first shared 2020 · discussion on HN
- 13Nim Types1 people · 2 points · first shared 2018 · discussion on HN
- 14NXP has messed up their password form validation1 people · 2 points · first shared 2023 · discussion on HN
- 15Teaching old C code new tricks with Nim1 people · 1 points · first shared 2023 · discussion on HN
What HN people wrote when they linked it
PMunch · 2020-04-07
https://peterme.net - If you've heard about Nim and want to see what someone is doing with it. Along with various other projects and presentations I do.
samatman · 2024-05-09
I've been a Nim respecter for many years, it's slept on in general as a language.
The difference here is that Nim compiles to C and you can turn the garbage collector off: Zig compiles C and there's no garbage collector. That means the entire standard library is available when generating object code. It's also trivial to opt-in to the C ABI on a fine-grained basis, by defining a function or struct with the extern keyword.
I believe this is still fairly current about the difficulties of building Nim dylibs for C programs: https://peterme.net/dynamic-libraries-in-nim.html
I expect Nim will stabilize about where D has: it will have a dialect of the language which, with relatively painless accommodations, is able to produce object code which speaks C ABI. Zig is different. The language is relentlessly focused on providing a better alternative to C while occupying the same niche, and a lot of design time has been spent on making it practical to take an existing C program and start writing the new parts of it in Zig.
It's a good language, Nim, and getting better. I'd recommend it for someone who is considering Go, for example.
TylerE · 2020-05-06
Lisp macros operate on a representation of the AST.
By overhead I mean the nim compiler can generate direct specific instatiations at compile time instead of doing runtime based duck-typing as in lisp.
Like, you can have a macro that generates a different expansion based on the type of arguments passed, if you structure the macro that way.
The macro can also take entire code blocks as arguments of course, so you can implement general purpose control structures that are first class citizens.
Here's an example: https://peterme.net/cross-platform-guis-and-nim-macros.html
haxscramper · 2021-10-19
Adjacent comment already has a list of concrete libraries/frameworks for large number of areas, so I just want to mention that nim has a very good metaprogramming capabilities, and if the /language/ itself does not feel up to the task you have a lot more freedom when it comes to implementing things. So it really comes down to the community size and amount of money poured in the development, and not fundamental problems with the language design.
This is mostly an argument about "technically you can write anything with anything", except in nim's case it is also backed by extremely high flexibility.
EDIT: by flexibility I mean
- different backends they covet very huge ecosystems (Js and C, and by extension anything they you can interface with using C (like python))
- already mentioned metaprogramming
- support for low-level convenience features like custom operators
- different memory management options. If you want you can turn off automatic mm completely and write code that deals with pointers and stuff like that directly
- more niche things like support for embedding nim interpreter in your programs https://peterme.net/using-nimscript-as-a-configuration-language-embedd…