Hacker News new | comments | show | ask | jobs | submit login
Show HN: Nim in Action (picheta.me)
229 points by dom96 10 months ago | hide | past | web | favorite | 40 comments

Author here. The development of this book has taken a while but I'm happy to say that it is now in print!

Chapter 1 and 8 are free so be sure to give them a look if you're new to Nim.

Previous discussion for the curious: https://news.ycombinator.com/item?id=10987975

Happy to answer any questions.

Perhaps you should make chapter 3 free too? That's the kind of material is want to see before I decide if I like the language or the book.

Of course, you might have a good reason not to do it, but that was my first thought when looking at the web site.

One of the things that can hook you into a new language is having a really well written introduction book that gives you the philosophy of the designers and the big picture while moving through the syntax and semantics.

The book is roughly 300 pages. Even with a careful reading that's only a few days invested.

For instance I read Roberto Ierusalimschys's Programming in Lua and Niklaus Wirth's Algorithms + Data Structures = Programs. But have never really had a project which fit either of those languages. I still enjoyed the books.

That is the big advantage of getting books out on shelves, so people can look through them. That's harder to do with more independent works.

Now that I think about it, I use to buy programming books in University and just after (2005-ish), but I haven't really since. Even when I work places where we have a book budget; I never request anything. These days I read the documentation, and if I get stuck, I go to a stack exchange site.

Hi Dan

If it was up to me I would make the whole thing free. The publisher has to make their money somehow though :)

I was given the option to make two chapters free. I figured an intro to Nim and an advanced chapter were good choices.

Congrats on finishing the book! Writing one is a monumental task, and a great thing for Nim.

Thank you! It was indeed a lot of work but I'm really happy I got through to the end. Incredibly excited for everyone to get their print copies :)

Do you have a link to the free chapters?

Ok, I found them. https://www.manning.com/books/nim-in-action?a_aid=niminactio...

You can click/touch the chapters under the "What's inside?" section to see the download buttons. But here are the direct links anyway:

Chapter 1: https://manning-content.s3.amazonaws.com/download/4/7959d94-...

Chapter 2: https://manning-content.s3.amazonaws.com/download/5/08b3cf8-...


I have been waiting for this book I have had this book in my wishlist for quite a while. Nim looks interesting and compiling to C is highly desirable to me.

I much prefer a well written book length introduction to reading through the documentation even if its good.

I just ordered my book. Here's a 37% off discount code: fccpicheta courtesey of /r/nim and /u/psychotic_primes

Thanks, that convinced me to pull the trigger.

Now that there'e even a book about Nim, what kind of production-level code do people write with it ? As a Python lover, Nim looks very nice on the surface...

My company has several Nim services in production. Here's an open-source component I wrote that we use:


Nice! It would be great to have this in Nimble's package list if it's not there already :)

A lot of different things. CLI applications, games (a large proportion of the companies using Nim are doing this, and some indie devs[1]), web applications, GUI applications, some are using it for scientific applications. The list goes on and on :)

1 - https://impbox.itch.io/vektor2089

Hey, glad to see it's about to hit the shelves, I've been waiting for this one since around February. I've just chucked my order in.

Brilliant, thank you for grabbing a copy! Let me know if you've got any questions.

I pre-ordered it a while back; I love the Parallelism chapter. Cleared up a lot of things for me as to the concurrency model of Nim.

I'm glad you like it. I'm particularly proud of that chapter :D

I've checked my doorstep for this book every afternoon since April ;) and am super stoked. Great book! I've learned a lot through the projects.

I see there is supposed to be videos that didn't make it into the book. What subject matter will those cover?

Currently my plan for these videos is a couple of "how to"s for Nim. For example: a simple one showing how to install Nim.

That's helpful. It wasn't particularly hard for Windows with Cygwin, but only because I'm used to it. If this had been my first language before Python I would be sorely confused lol.

What are the benefits of using Nim over any other language?

There is a very terse and pleasant syntax that reminds people of Python, but it compiles to C and is very efficient, and binding to C code has no cost and is very easy as a result.

garbage collection is optional and configurable.

Nice work! I just ordered both physical copy and ebook from Manning.

Thank you! Be sure to get in touch with me or the Nim community if you've got any questions :)

Can Nim be used as drop-in replacement for C, like Rust?

Yes, the nim compiler outputs C-source code then passes that to your compiler. It can also output other languages. That said while a lot is configurable, I wouldn't consider the generated C as something a human can work on.

Doesn't it has garbage collection?

Optional garbage collection, with choices on which type of garbage collection.

I wonder how well the Nim standard library handles this. D has been controversial with this because the standard library expected GC to be enabled although allowing it to be disabled. I think this story has improved but it may have hurt adoption as a systems programming language that is now hard to restore.

Sadly this is something that Nim can also improve on. I will actually be looking into getting the stdlib ready for the highly sought after 1.0 release and will be keeping this in mind.

The stdlib not working without GC, making not truly optional, is one of the main reasons I stopped using nim - though I haven't checked if this is better in some time.

What were you planning to develop? This should help me figure out whether the stdlib still has an issue for that use case without a GC.

Embedded code, modules for use in higher level languages - and this is the killer, memory management in "mixed" contexts

Well it works without GC, but memory is never freed :)

Right, I'm sorry, I suffer a narrower definition of "works" :)

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact