About the book "Nim in action" and DSLs

Some days ago I received a reference about the book “Nim in action” in a newsletter from Manning, about the Nim programming language.

The chapter 9 is about metaprogramming, and it mentions DSL:

1 Like

I have bought this book when it was still in Early Access, a few years ago (many chapters were still missing at the time, and Nim was still a long way from its v1.0 release). The book was written by one of Nim’s main contributors and developers, and it’s a good book if you like the approach of learning a language through practical examples and explanations.

The book was ultimated while Nim was still being developed, and hasn’t been updated after Nim v1.0 was released — so some aspects of the language have slightly changed, and adjustments need to be made to the code and tutorials (but I believe the downloadable source code was updated though).

I haven’t had a chance to spend as much time with Nim as I wished to, but from the little that I’ve managed to I’ve learned that it’s a very versatile language for creating DSLs, thanks to its powerful meta-programming features and macros system — that is, if you don’t mind having to deal with a language that has a garbage collector.