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!
Please do try it out and report the results on the Nim forums (or via blog post). This is one of the chapters where I will need to do some research first, as I don't have much experience with this kind of stuff. So any ideas for this chapter are very much appreciated!
I thought it would be a nice chapter to end the book with though. Plus I am excited to play with this sort of stuff.
My current plan for this chapter is to try replicating some of the projects in the Arduino starter kit and to see where I can go from there.
Thank you for your feedback!
The biggest dimensions for me when first evaluating a new language that I might want to learn more about someday are typing (dynamic, untyped, or static, and if static whether that's of the Haskell variety or more mildly anti-certain-class-of-errors-driven plus performance-driven like most other things) and garbage collection (none, forced, or optional). That info helps me immediately bucket what sorts of applications this new language could help me take on in a better way than other languages I know. With Rust, watching it develop I didn't think too highly of their decision to remove the @ sigil (that is, remove the GC from the core language). That's what ultimately made me think of Rust only as something I'll ever try to learn and use if I come across the narrow (in my interests) problem domain of "I absolutely require a Safe program but for some reason I can't use a GC language."
I think your first 12 pages do a pretty good job at highlighting some of the hooks that originally put Nimrod on my watch list whenever ago, though personally I'd put the style insensitivity thing last (and it doesn't cover things like omitting parens for single-arg or no-arg functions but you mix that particular style choice around throughout the chapter). Those hooks, including some you don't really cover yet, are speed (like, at or even sometimes beating C-level speed), all three of optional, tunable, implementation-detail-swappable garbage collector with access to malloc/free or even just embedding C code directly like you might embed ASM code directly in C code, inferred static typing to minimize ceremony, the huge list of pragmas to tell the compiler -- which humbly admits it tries its best but is not all-knowing -- about useful things for performance or other reasons, user-defined compiler demands (not "hints", as it's not optional) to make optimizations via term-rewriting macros, style choices (but sadly no Lisp-like dashes in function names), and an awareness of and support for many higher level language features enjoyed by other languages. No forced main() and whitespace indentation make it immediately comparable to Python on the surface which is a nice bonus (for those that like Python anyway). Taking all these things together, there isn't really a comparable language, or at least not one that's on very many people's radar. I think the only language worth mentioning (or not, per strategy) as one that might surprisingly come up from behind in n years and eat Nim's potential big lunch by then is Pony.
Another nitpick, in the section on functional programming, why use var instead of let? The immutability story is just as important as first class functions... And you're missing the item (->) in the list of things the modules were imported for...
I agree with many of your points and I will do my best to incorporate them into my book.
The reason I have compared Nim to Python so heavily is for two reasons:
1) I used to be a Python programmer and chose Nim as a replacement.
2) I see a lot of Python programmer's trying out Go and saying describing it as a "better, faster Python". Perhaps that is just a HN illusion. I in turn believe that Nim is far closer to Python than Go will ever be. I am trying to show people that. Perhaps I should be comparing Nim to Go more as well.
Your list of hooks is brilliant. It's hard for someone like me to remember features which make Nim unique since I use it almost every day, so these are really useful. I will see about mentioning some more of those things, in order to hopefully grab more people's attention!
I have heard of Pony but have not had a chance to try it out. Looks promising.
> Another nitpick, in the section on functional programming, why use var instead of let? The immutability story is just as important as first class functions... And you're missing the item (->) in the list of things the modules were imported for...
Will fix, thank you! I have started out using 'var' then changed everything to 'let' (where appropriate), must have missed that one.
Thanks again!
I am not sure if this is covered, but did not notice it mentioned in the contents.
I don't think it is possibly to cleanly implement a epoll/kqueue-backed multi-threaded (web)server/reactor without it.
Currently you have to use allocShared, allocShared0 etc to use shared memory. You must then manage the memory yourself.
I certainly understand the appeal of whitespace if you're coming from Python or Haskell etc. just wanted to point out that it might not be for everybody.
As for the web development focus, I would certainly understand not wanting to discuss topics in the book that you yourself are not that confident about.
Good luck with Nim going forward.
I will likely give Nim a go, despite its significant whitespace and weird variable naming rules. In any case I continue to follow Nim and wish the project every success.
Pretty much how, parens are not a concern for actual lisp programmers.
C was my first language, so I had the "significant white space" prejudice. The first time I tried it, I was hooked - because I hate code improperly indented.
Yes, you can go the gofmt route in order to eliminate indentation wars, but I love languages where the syntax enforce it: it is a very pragmatic design (no need for explicit start/end of blocks, no ";" to mark the end of the statement).
Strange enough, Nim enforces indentation but is very liberal with case sensitivity. Go figure... :-)
EDIT: s/sensitivity/insensitivity/
Do you mean "case insensivity"? AFAIK dynamic languages where you can do that are very much case-sensitive, Python and Ruby certainly are.
I agree, but my concern is not correctness, it is aesthetics.
Why? Reading a computer program is often harder than writing it from scratch, so I like when languages enforce (or at least encourage) a name convention - just to keep it easier to read. Does Nim have something like PEP-8?
https://github.com/nim-lang/Nim/wiki/Style-Guide-for-Nim-Cod...
It doesn't matter for my own code because I already write it that way, but it enforces good indenting behavior on others who might otherwise forgo it.
> how best can we help Nim to move towards that goal right now?
There are many ways. One way of course is to use Nim, test it, give us feedback, write Nim libraries and tell other people about it. But the best way is to get directly involved in Nim's development on Github, help us fix bugs, discuss the future direction of the language and help us implement new features. Here is a list of "Easy" bugs to get you started: https://github.com/nim-lang/Nim/labels/Easy
Another alternative is donations. Nim accepts donations through Bountysource[1], and Gratipay[2].
Better standard library support for Go-style CSP. Given that CSP is one of Go's biggest selling points, it'd be great if people could easily translate concurrent Go programs to Nim and see the benefits. Right now the lack of a "select" statement makes that quite hard, especially for a beginner.
Most editors can be configured to show whitespace. Either in a low contrast color to avoid creating too much noise, or toggled in/out when needed.
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.