14 ms·
Show HN: “Nim in Action” is now available
- dom96 11y agoAuthor here! Even if you don't intend to purchase the book I would love to hear feedback from you about the first chapter (which is free!)[1]. Really excited about this book and am looking forward to any feedback at all from the HN community. 1 - https://manning-content.s3.amazonaws.com/download/6/df42fc6-bff6-453b-9482-641468038572/Picheta_Nim_MEAP_V01_ch1.pdf https://manning-content.s3.amazonaws.com/download/6/df42fc6-...
- gokr 11y agoGreat work man! I will get one for sure.
- dom96 11y agoThanks man! :)
- steveklabnik 11y agoSeems good! One small note, since I know that this book is getting started: Rust does have some amount of CTFE available in nightly (const fn), and it and/or compiler plugins may very well be stable by the time this book is released. So you might want to make a note to double-check the state of that when you're closer to a final draft. Congrats and good luck! Writing a book is so rewarding, but so draining.
- dom96 11y agoThank you for taking a look! I will certainly keep my eye on that and update my table appropriately :)
- nickpsecurity 11y agoI'll try to do that since Nim is on my list of languages to check out. Keep hearing good things about it.
- 3pt14159 11y agoFirst chapter is good. It introduces the main concepts gently. I would have mentioned compile times, since it is one of the main draws to Go, but other than that I think the first chapter is good. Even though I write Nim code, I still bought the book, but more so for the later chapters: 8. INTERFACING WITH OTHER LANGUAGES 9. METAPROGRAMMING 10. DIRECT HARDWARE CONTROL Since I don't have very much experience there. Also maybe a chapter on debugging might help, especially for people that are coming from Python or Ruby. Best of luck with the rest of the writing!
- dom96 11y agoThank you for reading and posting feedback! I think you're right, Nim compile times are fast and deserve to be mentioned. Will make a note to add this. Debugging will be a part of Chapter 5. But I will make a note about addressing people coming from Python and Ruby. Thanks again!
- systems 11y agowell, i dont know if nim have a free book yet, but i would suggest making the ebook free this will encourage students and casuals to look into nim
- dom96 11y agoI would love to, but unfortunately I have signed a contract with Manning so I can't just release it for free. Once the book goes out of print it will likely become free though.
- ilaksh 11y agoThere is a free manual, free tutorials, core source is free, all Nimble packages are free, free tutorials in blog posts, free first chapter, many free projects..
- Jach 11y agoPlus the book's source code examples will be free. (And, if we're honest, the book itself will be free too on various book-download sites...)
- echelon 11y agoBased on my surface-level understanding of Nim, Go is much more comparable to Nim than it is Rust. I never understood the Rust-Go comparisons, since Rust is a serious systems programming language. I would never use Go or Nim to replace C or C++ usage as I would Rust, but I might use Nim in place of Go or Java. Does anyone with significant Nim experience care to lend some opinions? I don't want to start a flame war--I'm genuinely curious.
- kasey_junk 11y ago> Rust is a serious systems programming language I assume the distinction you are making about "serious" is around manual memory management and the GC? In which case, I think you are probably right in your bias. That said and while i have no experience with it, Nim claims to have a real-time GC mechanism builtin. That is they support a max pause time parameter. There have been other real-time GC systems out there before and they tend to work well for other definitions of "serious".
- k__ 11y agoI have the feeling, that "in the wild" most people replace JavaScript (Node.js), Python and Ruby with Go. Rust seems to be more of a C/C++ replacement.
- notacoward 11y agoIt would be really interesting if someone could collect statistics on which languages are used to replace code written in which others, in practice and not just in theory. Something that crawls GitHub, maybe, but I'm not sure exactly how to specify what it should look for. Any ideas?
- EugeneOZ 11y agoI replaced PHP with Rust and very happy about it.
- patates 11y ago
- AsyncAwait 11y agoGreat to see Nim getting an official book, (Dominick is almost like a co-author of Nim at this point :-). My impression of Nim is that it is what Go should have been, if language developments of the past 40 years were taken into account, so if you like the simplicity of Go's syntax, but want modern features, seriously consider Nim. I personally couldn't get over the significant whitespace, (relying on invisible characters doesn't sit well with me) [1], but apart from that I like the language a lot! @dom96 Do you think that the focus on web development is good to have? I realise that it is what a ton of people do these days, but since web developers already have so many technologies to pick from, perhaps selling the book as aimed more at system/game even native desktop developers could spring up more interest. Also, how exactly is the garbage collector tied to the standard library and the language itself? For example, if I opt out of the GC completely, would I end up in a situation similar to D, where I'm not using GC but everything around me still is, so I have to carefully program around it, or is it handled differently? (And can you possibly compare Nim and D as the languages seem to be covering similar territory.) Lastly, what major work still needs to be done before we see a 1.0 release and how best can we help Nim to move towards that goal right now? Thanks, back to the book now... 1 - Maybe a gofmt style tool would help somewhat.
- sdegutis 11y agoYou could write a little tool that transforms the syntax you prefer into Nim's syntax before compilation.
- dom96 11y agoThank you for the kind words! I'm happy that you can see the positives in Nim even though you dislike one of its most prominent features. Personally I love significant whitespace and have started using Nim because of this feature, basically back in the day I just wanted a Python alternative that was compiled. If you really dislike it that much, you may be able to convince Araq to bring back his old time idea of allowing different syntaxes in Nim. As for a gofmt tool: `nim pretty` exists but may need to mature a bit. I believe that a focus on web development is good. One of the reasons why the book has such a strong focus on it is because I have spent most of my time implementing stuff which is necessary for web dev in Nim, and I want to show it off. The fact that I have a lot of experience with it helps too. I would love to show off as many things as I can, and I might look into including some examples of SDL, SFML, and more as well as ways to utilise Nim's real-time GC for games. But I must be careful, the book is already becoming rather large :) As for systems, there is a whole chapter dedicated to Direct Hardware Control in the book. But I will make a note of maybe including something for native desktop developers. In terms of the GC, I don't have as much experience using Nim with no GC as I would like. So I can't really comment as to the current situation. In terms of a comparison to D, I've already received feedback to add D to the language comparison table in Chapter 1. To compare these properly I will need to do some research first. Nim is very close to 1.0 now. We are planning on looking at the standard library and ensuring that it is in tip top shape before 1.0 is finally released. There is also work currently happening to make asynchronous IO multithreaded. Thanks for the feedback and hope this answers your questions!
- doboo 11y agoCould be of interest if the creator didn't self-promote the language through an aggressive tone "after a few beers" https://hero.handmadedev.org/forum/code-discussion/937-i-would-like-to-recommend-the-language-nim https://hero.handmadedev.org/forum/code-discussion/937-i-wou...
- z92 11y agoRead that discussion. Learned a lot of good things.
- charlieflowers 11y agoWow, you're right, that's a hidden gem. Thanks for pointing it out.
- Jach 11y agoIndeed.. Seems the admin's point of view is "it's all fine and good that your language can manipulate ASTs with ease, but with the mere search-replace support of C (and perhaps other tools that actually try to parse code, can't show anything though or even describe what they do) I've hacked some really awesome things that I want included as already implemented macros or whatever out of the box in your new language to get me to switch." There's a fun quote on Nim's standard library reference page: "The good thing about reinventing the wheel is that you can get a round one."
- ephja 11y agoHow do you know it's the same guy?
- gokr 11y agoThe creator? I may be daft but that is someone saying he/she has been using Nim for one year?
- veidr 11y agoYou are right, that is just some random drunk person on an internet forum recommending Nim (who has apparently picked it up recently, and says they are going to write their next project in it). It's not creator Andreas Rumpf or anybody central to the Nim project.
- incepted 11y agoNote: the title is misleading. The book is not available yet, only the first three chapters.
- overcast 11y agoYes, and the first is free. I was considering a purchase, but there's not really much to read at this point. FYI, "mlpichetatw" code will give you 50% off this book on checkout.
- incepted 11y agoThe main problem with languages that generate C or some other language is debugging. Does Nim have a good answer to this?
- def- 11y agoSimple example of GDB debugging: http://hookrace.net/blog/what-makes-nim-practical/#debugging-nim http://hookrace.net/blog/what-makes-nim-practical/#debugging...
- audunw 11y agoNim works quite well with GDB. I've tried it. It can generate metadata that GDB can use. It's not perfect, but for my uses it has been alright (but then I'm ususally the kind of person who prefers to use debug printing and just studying the code) Nim also shows very nice stack traces on uncaught exceptions so that also reduces the need to fire up GDB.
- kevin_thibedeau 11y agoAn LLVM backend was recently announced. If that matures then the debugging issue will be simplified.
- deleted 11y ago[deleted]
- Lovenim 11y agoI should like to know if Nim can be used for machine learning or for deep learning. How could be located Nim in comparison to Julia, numpy, Torch7 and the tools for deep learning and AI that many big companies are open sourcing.
- andreaferretti 11y agoI think Nim would be ideal for that kind of applications, in particular neural networks stuff. But definitely we are not there yet. I try to explain my reasons in this blog post: http://rnduja.github.io/2015/10/21/scientific-nim/ http://rnduja.github.io/2015/10/21/scientific-nim/ To get to a point where we have something good to use, though, there are a few libraries to develop. I started working out a basic layer for linear algebra, that is needed in many applications - see http://unicredit.github.io/linear-algebra/ http://unicredit.github.io/linear-algebra/ I hoped I would be able to start working on some neural network stuff based on that, but I did not find the time yet...
- Lovenim 11y agoInteresting post. I also enjoyed the posts about Torch but when installing in ubuntu 15.10 there were some problems. Libraries are necessary to avoid reinventing the wheel.
- dang 11y agoWe added "Show HN" to the title (the convention for sharing your own work on HN) because the post is by the author and, when the project is a book, a free chapter is a nice way to let people try it out.
- AsyncAwait 11y agoSuggestion: It may be a good idea to show line numbers in the code samples, since the compiler error messages, discussed in the text, refer to them quite extensibly.
- dom96 11y agoAgreed. Will make a note to add that, thank you!
- BuckRogers 11y agoI test drove Nim when it was "Nimrod" quite some time ago, sounds like 1.0 is coming soon. Looking forward to it! It's really good to see Pythonesque languages pop up.
- hellofunk 11y agoMy questions! I have never written a line of Nim but am enticed: >Nim allows you to use snake_case even if the identifier has been defined using camelCase, and vice versa. Can you also just write it all lowercase, and same synonym effect? i.e. snakecase > The default garbage collector is real-time so it allows you to specify the amount of time it should spend on collecting memory. Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it actually just adding calls to free for you? > This applies to languages such as C++, Pascal and Ada. But these languages still require platform specific code when dealing with more specialised features of the operating system, such as creating new threads ... Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading. >The speed of a programming language is one characteristic that is often used to compare multiple programming languages Since this statement is in the book, it would be nice to see Nim programs participating in the online benchmarks game. >Table 1.2 Common programming language features A little misleading or perhaps just incorrect to place a No in C++'s box for metaprogramming. Entire books have been written on C++ metaprogramming.
- dom96 11y agoHello, thank you for the questions and feedback! > Can you also just write it all lowercase, and same synonym effect? i.e. snakecase Yes, the first character is case sensitive, but the rest is not. foobar == fooBar == foo_bar == foo_Bar but FooBar != fooBar. > Since Nim compiles to C, which is not garbage collected, does Nim just automatically add its own C-based GC library behind the scenes (no small task), or is it actually just adding calls to free for you? Nim adds its own Nim-based GC library behind the scenes. In fact, it supports multiple GCs (which can be changed via the --gc flag). > Not true any more for C++, since the new C++ standard 5 years ago, which contains cross-platform standard library tools for multithreading. Is this standard well supported by now? I'll change it to 'C' in any case. > Since this statement is in the book, it would be nice to see Nim programs participating in the online benchmarks game. I agree, maybe you can convince them to include it: http://benchmarksgame.alioth.debian.org/play.html#languagex http://benchmarksgame.alioth.debian.org/play.html#languagex :) > A little misleading or perhaps just incorrect to place a No in C++'s box for metaprogramming. Entire books have been written on C++ metaprogramming. Somebody else raised this point. Will correct. Hope this helps!