I like Nim syntax the best, and Crystal and Zim are tied for second. I don't mind a small library / ecosystem. The main things I'm interested in are:
- I want to write once and run on Windows / Linux / Mac. (I'm not writing a GUI.) - Concurrency and async capabilities - Safety guarantees (both types and threads) - Speed
I'd be interested in people's recommendations, or links to comparisons between these languages.
The other languages that you didn't mention but are worth evaluating are D and Go. Again, they have advantages and disadvantages that may make them either more or less suited to your application.
But, why do they have to hit 1.0 by the end of the year? Who's the arbiter of this deadline?
> I want to write once and run on Windows / Linux / Mac. (I'm not writing a GUI.)
Portability is Nim's great strength. You can even target some really obscure platforms, as long as they have a C compiler (which they likely will).
> Concurrency and async capabilities
Concurrency in Nim is offered via async await with first-class support for Windows, Linux and macOS (IOCP, epoll and kqueue). It's implemented 100% using Nim's macros, so you can easily dive into its implementation and modify it to suit your use case without having to mess with the compiler source code. It's all implemented in the standard library.
Nim's async has also been used in production for quite some time now. One example is the Nim Forum: https://forum.nim-lang.org.
> Safety guarantees (both types and threads)
Parallelism in Nim is a little different than in other languages. Each thread has its own GC and memory sharing between threads is limited. This ensures safety and performance (no stop-the-world GC).
> Speed
Out of all the language's you've mentioned I would say that they are all pretty similar in terms of speed.
Hope this helps!
Pony has compile time guarantees on not having data races, dead locks, runtime exceptions. It accomplishes this in a different way than Rust. For concurrency/async, Pony is Actor based, which I find to be a joy for modeling concurrent applications.
Here's a high level: https://www.ponylang.org/discover/#what-is-pony
I've always enjoyed programming in Nim when I've had the chance. It doesn't fit all kinds of projects, but it sounds like it'll fit yours.
Zig is too young to build anything significant with it. But to me, it's the most promising language for embedded and low-level development, and where you need good control of memory management. I've played around with it a lot recently and looking forward to use it more in the future.
Sorry to be unfair but: is being _new_ the prime quality of a programming language?
I wouldn't say Nim is "radical", but it is interesting in that it combines ideas in a way that I've not seen in other languages. Whether or not it really takes off, it's a good thing that it's around - if nothing else, it's a slightly easier way for devs who work primarily in higher-level languages like Python and Ruby to encounter concepts they might not otherwise encounter, like macros and a complex type system.
Probably a bigger factor is that Nim doesn't have a well-known organisation such as Google/Mozilla behind it.
I liked playing with Nim in spare time. But, I don't think I'll use it for anything I care about to maintain for a long time.
That being said, this is a very well written tutorial. Might be a nice format to use in other basic language tutorials.
This is a great feature when interfacing directly with C libraries. You can declare the names as they are in the original library, which is best for debugging and reference. They can be a variety of styles, but in your code you can refer to them all with camelCase so you have a consistent style in your own code.
I've never had any problem with it. It just works, and if you don't want to use it, it's not going to be an issue.
Author of the tutorial here. Thank you very much for your kind words!
> Significant whitespace and case- and underscore insensitivity. That's pushing too many of my buttons for one language.
Coming from Python, I had no problem with the significant whitespace. I like it more than curly braces everywhere.
Case- and underscore- insensitivity were something I initially really didn't like. What were they thinking? Are they out of their minds?
After using Nim for a year, I must say I didn't experience any problem with it so far. All the code I have written, all the code from others I have read uses camelCase (which is a recommended, but not enforced, case). So basically, even though people have an option to use snake_case (or any other), the large majority of users use only the one style.
I didn't expect that somebody else might post a link to it - it seems I might be too late for the party.
If anybody has any questions regarding Nim or suggestions how to make the tutorial better - let me know.
I know this is dangerously close to bikeshedding territory, but if I may, I wanted to point you to a similar resource that I recall being particularly pleasing to read way back when I was getting started in Python / Django:
https://web.archive.org/web/20080730140551/http://www.django...
That content has been retired from djangobook.com, and the website's design has followed suit, hence the archive.org link. I suggest also perusing the table of contents and making note of small design hints such as the use of color, whitespace, "Note" callouts, etc.
At the very least, I hope you'll find this inspirational if you decide to take a moment to rethink typography, typesetting and the overall design of the website and PDF.
Thanks for the feedback!
I would very much like to improve the looks of the website and PDF.
The current situation is this: I have zero experience with html/css, so I just took some css template and tweaked some values (lots of trial and error) until it looked okayish (There is probably some unneeded stuff in there too). And PDF is created by using the default style of asciidoc-pdf - I guess this can also be customized, but haven't looked into it yet.
Having said that, if somebody with more web-experience would like to improve my style.css [0], PRs are welcome.
[0] https://github.com/narimiran/nim-basics/blob/master/style.cs...
But while I think the content is good, I think your framing is way off. You state explicitly up front that this document is not for experienced programmers, but for novice users and people unfamiliar with programming. You go so far as to assume they're so novice that they don't know what "printing" means in terms of text to a screen. I'm going to kindly suggest that this document won't be very helpful at all for those users. To illustrate why I think so, I'm going to walk you though reading this document from a true novice perspective:
I'm reading the tutorial. I follow the installation instructions, and all of a sudden I'm installing over 500 MB worth of stuff to my machine? Many novice users may be coming from Windows, and some warning about this upfront would go over well.
As a user who you assume doesn't understand even the basics of printing to the screen, you've asked me to download and install 500 MB worth of stuff just to run the compiler, and then you suggest I may need three additional tools (well do I or don't I?as your reader, I'm here for your opinion. I don't know the merits of any of these tools). It's more helpful to be authoritative in situations like this. Leaving too many options open for a novice user leads to confusion.
But I persist, and I've downloaded your language tooling, MinGW, VSCode, assorted plugins and other things, and I don't really know what they're for. But after all of that, the payoff is to print a word to the screen. I would be a very determined reader if I continued at this point.
But the remainder of the tutorial is supposed to take us from readers who don't know programming at all, to readers who can write programs. And the way you've chosen to do so is to introduce notions of types of data, and then build on that to the point where you are doing operations on data. That is a tried and tested pedagogical tactic for presenting new syntax to experienced programmers, but the novice is left fumbling and confused about what those data types are for and how that relates to the problems they'd like to solve with this language.
You don't let the users write an honest to god program that has input and output until the very end of the tutorial.
I'm sorry if I seem overly critical, but I think this tutorial could be much much improved if you just admit what it is (a tutorial exposing Nim syntax to experienced programmers), and reframe it as such.
P.S. Thank you for the kind words about Nim in Action!
1 - https://forum.nim-lang.org/
This is not strictly true, in languages with type inference (which are becoming increasingly common)
From the tutorial:
> Nim also has type inference ability — the compiler can automatically detect the type of a name assignment from its value, without explicitly stating the type.
Static typing with type inference is still static typing.
Vaguely related: many people also confuse 'dynamically typed' and 'untyped', despite that they're not even close.
I’m not deep into this yet but I dig the ‘voice’ being used. It’s difficult to break ‘obvious’ things down to those without background while staying concise.
Thank you very much! It means a lot to see this kind of feedback.
> It’s difficult to break ‘obvious’ things down to those without background while staying concise.
After writing this tutorial, I can only nod and agree with this statement - it took me much more time than I originally thought it would.
Thank you :)
> I can politely ask the publisher next time please do use bigger or darker fonts for code
I think it's unlikely the publisher will see your message here. You might have better luck Tweeting at them or emailing them.
Nim: https://forum.nim-lang.org/t/1779
D: https://forum.dlang.org/thread/mailman.1427.1428691340.3111....
And the following is probably one of the most extensive comparisons of the two languages: https://github.com/timotheecour/D_vs_nim/
In the past I already mentally classified it as a not very well defined language, with a not very well done feature set analysis. A comment in HN described it in a way that seems to fit: (...) a hodgepodge of stuff thrown together, a lack of language design with a surplus of features (from this thread: https://news.ycombinator.com/item?id=11960814)
It's not the only time when the language's (arguably) unnecessary breath has been critiziced: from having a suprisingly huge feature set (https://news.ycombinator.com/item?id=13312205) to implementing everything but the kitchen (sink) and having a lack of engaged contributers, leading to many bugs, little documentation, and a very messy standard library (https://news.ycombinator.com/item?id=13355579).
Have those comments (which admittely only represent the personal opinions of their owners) been rendered outdated by now?
I'd argue that for an absolute zero-knowledge starting point, Rust would be more valuable to start learning, given that both would have a big (or "huge") surface but very different levels of apparent polish and structural design choices behind them. But of course, it's all a matter of taste.
> People with minimal previous programming experience
> People with some programming experience in other programming languages
Both mean the same.