When I was doing the rounds roughly 10 years ago, trying to find a new programming language to learn, my money for "next big thing" landed on nim. I did some personal projects and absolutely loved it but, unfortunately, opportunities to work "on the clock" in nim never materialised and then rust started eating the world.
Thanks, Andreas Rumpf, for sticking with it for all these years: This seems like a great opportunity for me to get back into nim.
> Nimony is case sensitive like most other modern programming languages. The reason for this is implementation simplicity. This might also be changed in the future.
I've never been too annoyed by Nim's approach but I think this removes a complaint many people have.
I am not sure. I think Nim is a fine language, but it is a little bit cumbersome as well, due to the typing. People complain just about everything, so this is not a good metric to use as the only metric. Nim has a similar problem as crystal has: too few users. With the rise of AI, this problem has amplified. You can see it if you look at Ruby, how it declined in the last two years. I wonder what young people do these days. Has learning programming languages become worse here?
I’m curious if this closes the door on Nim’s capability to output C code which you then compile yourself. I first discovered Nim when I was looking for something that could work with Apple’s requirements to embed bitcode in iOS apps, it meant you had to use their specific version of LLVM and that ruled out a lot of languages. It always seemed like a really unique feature (though IIRC Haxe has something similar).
Apple has long since removed that requirement so it doesn’t really matter anyway and I wouldn’t blame the Nim folks if it’s gone, these seem like a great set of improvements.
This is a great part of Nim. I started using it with ESP32's for 5+ years or so now. Nimony is even more ideal for embedded.
Great part is that Nim's stdlib networking was easy to port to esp-idf's lwIP based network stack. So you get access to production Nim libraries for lots of networking stuff, or async, etc.
Nimony plans multiple backend targets, reflecting Nim’s philosophy of not being tied to a single code generation strategy:
NIFC to C Translator: This is close to being production-ready. It even generates makefiles. For a language that has historically compiled to C, this ensures backward compatibility and continued access to GCC/Clang’s optimization pipelines.
NIFC to LLVM Translator: Planned for future releases. This would enable Nim to benefit from LLVM’s extensive optimization infrastructure and target WebAssembly.
I don't think we can call that transpilation as it's not a 1:1 conversion
But yeah, the native backend and LLVM backend definitively close the "transpilation" door
When Python did the migration, it had a good flow of new investments coming into it and delivered good reasons for why those should go to Python 3 rather than 2. At the same time, it also already had a base of existing investments in Python 2 delivering better ROI without the added cost of a migration, and the sum of that exceeded the critical mass it took to make it economical to keep both versions of the ecosystem around.
With Perl you are seeing what it looks like when you have zero new investments coming in and no good reasons for why new investments should go to Raku. (Because: Just use Python). You do still have a non-negligible base of existing investments in Perl 5 and those deliver better ROI without the added cost of a migration. So my prediction is that Perl 5 will stick around, and Raku is dead on arrival.
With Nim it might be the other way around: Good reasons for why new investments should go to Nim 3 rather than Nim 2, and not all that much existing investment in Nim 2. If Nim 3 sees healthy adoption, it might well be more economical to re-deploy ecosystem maintenance to Nim 3 and migrate most of the existing code, rather than keep two versions of the ecosystem going.
It was largely a question of the existing codebase. It took years to convert all the obscure scientific libraries from Python 2 to Python 3.
The migration was no easy task. So all the projects already written in Python 2 remained on version 2. Until the day they reached a dead end and were forced to migrate.
It was inertia. I was working at a company in 2017 in which 100% of the very extensive code base was written in Python2. The Python3 migration was done in a weekend and was mostly a nothing burger, as, with few exceptions, the conversion was 100% mechanical and just worked. The print vs print() was the most visible change, and the str/bytes change was a genuine improvement.
Except for no longer being confused about whether I was reading bytes or "strings" (Python3 eliminated that confusion), and having to remember for roughly a year to use "()" when using print, I don't believe I even really noticed that big a difference between the two.
Honestly - I'm surprised that python managed to hold on long enough for "uv" to be released and solve all the packaging/venv pain - that was a real problem with python for 15+ years and wasn't solved until 2024.
No. a) Python had vastly more users. b) That change hit things that were much more "mainstream" in the language, like string encoding and print as a function vs. a statement.
I've always had a soft spot for Nim, never had the chance to use it professionally. I personally can't wait to let it rip with AI. I think this is going to be the perfect language to use with AI. Fast as all holy hell, ergonomic, a language lead who cares deeply and does not quit. Major props to Araq for sticking it through all these years, I hope it's Nim's time to shine finally.
I did my first "real" nim project this year. I'd been tinkering with it here and there, but found a chance to use it. I'm coming from mostly python experience and found it to be a really nice experience.
yea nim is fuggin awesome i tried it this year too and ive seen enough python that it just felt straight forward. i lurv me some compiled stuff and everything ive built in nim does not disappoint on the performance front. i love using it honestly, feels like what i always wished python was
I think Nim is a great fit for the AI era. let me explain
Always appreciated how Nim gives you a low cognitive load: it is easy to reason about, does not get in the way of doing stuff, you focus on what you need to do it and rarely on how you do it (specifics of the language).
I think this is a great advantage in this era of automatic/AI assisted programming. The fact that the language is very readable also helps for the moments when you need/want to read the code.
Nimony btw is a very cool way to evolve the mainline compiler and looking forward to use this in main Nim (but it is also something nice to experiment with)
I thought it would be the opposite, because you can't say: "The AI was trained on a bazillion lines of idiomatic Nim 3 solving a wide range of common problems"
Yep that is the expectation one could have but it is not the experience I (and many others) had.
The explanation I have is that it is so close to pseudocode that it only needs to know just a tiny bit about Nim peculiarities (not too many) to do a good job (plus static types and compiler help a lot).
Ai writes nim pretty well. Its close enough to other languages that llms can manage to write performant code with few issues. There are some gotchas, but the fast compile times and good error messages makes it easy to iterate fast for the bots.
I love Nim but my only problem with it previously was support for dictionaries/objects felt really weird? There was some sort of JSON structure as I recall, but it didn't seem anywhere near as easy to use as the analogous structures in Python/JS. Am I misremembering? Has this been improved?
Nim is very strict about types, which is probably what you remember. Things that are typically expressed as a dictionary/object in JavaScript and Python are better represented as a fully typed tree of objects in Nim. The language of course supports the data-structure dictionary/hashmap/table (called Table in Nim) which is "anything hashable" -> "any type" lookup. This is what's used for things like `myTable["hello"] = 5` for storing the number 5 for the key "hello". However because of the strict types you can't mix which types they map to without creating some sort of wrapper type that gives you the alternatives you're allowed to use. Many people reach for Nims JsonNode type to fill this gap for small collections of string/number/array/dictionary since it already is such a wrapper type.
As others wrote, what makes it unpalatable for you is static typing. You simply cannot make working with arbitrary JSON as convenient in a statically typed language as in a dynamic language (like JS or Python). No matter what you do, in a static language you need to provide or recover/generate the full type information of anything before you can use it (unless the language or the runtime system offers an escape hatch: some kind of "dynamic" type (but that means the language is now gradually typed) or strong reflection capabilities - which Nim doesn't provide to my knowledge). On the other hand, Nim has macros, so typing your JSON payloads is as painless as it can possibly be in the presence of static types.
So it's not really Nim's characteristic to make working with arbitrary JSON (heterogeneous collections more generally) "unpalatable" - it's common to (almost) all statically typed languages. While Nim looks a lot like a scripting language, it really isn't. It can be used as one, and it's much better for that than C, but it's better used for apps and systems programming than for scripting, like all the other languages in its class (ie. Go, Crystal, OCaml; Rust and Java are also close).
I suspect you're talking about heterogenous containers which are antithetical to a strongly typed language but nevertheless are supported via std/json's JsonNode dynamic data.
In Nim regular hash maps (called tables here) have pretty regular accessors via `[]` `[]=` overloads (`foo["frob"]=42`), plus additional routines such as `.get(otherwise)`.
It has a scoped responsibility, does mostly compute and data processing. Invoked by a PHP backend, single-threaded, we get parallelism at invocation rather than internally. So we can saturate server threads optionally if we need to.
Biggest win: Single-owner scoped lifetimes by default with no annotations plus expression-oriented value semantics makes it eminently readable. Basically no memory semantics, all business logic. (It does processing of proprietary binary data including a lot of math.) Extraordinarily easy to maintain, refactor, add features. Valgrind confirms no orphaned blocks in some of our biggest test scenarios, it's impressive. Full compile-time evaluation is nice too, easy to slurp a whole file at compile-time and have it accessible in a normal binding, and writing generic procedures is obvious and simple.
Biggest pain point: Hard to say, the only friction I've really ever run into is its weak tooling. I just use Make for build scripting (invoking the compiler directly instead of using Nimble) and Sublime's built-in features for refactoring. It's small enough that print-debugging works, but I occasionally dip into FlameGraph. Nimsuggest has some...dealbreaking quirks, but successors are in the works.
1) From std, a fully Nim-native tiny regex engine (the tinyre package fills this need, and I think it should be the default; the default regex engine brings in PCRE as a dependency).
2) From std, compression (I pull the zippy package as a dependency, and have built against Brotli and other compression libaries; whether compression should be in std is I think something Araq may have commented on already).
Aside from that, nothing. Nim's compiler has an extraordinarily powerful templating engine built-in called Source Code Filters: These build text replacement procedures at compile-time, and can handle most arbitrary Nim code, including generics and the compile-time `when` conditional, although certain sugary arrangements by the default parser can't work (Nim code in SCF must be prepended with a # to mark it, and control flow blocks must have end markers). I use SCF primarily for HTML reports, which is one of my primary outputs.
I have been eyeing nim for a while though I'm more used to curly-braced language families.
The first thing I evaluate in a language is how it looks like in production code, and the samples in github strikes me odd -- like most of the code identation is 2-space and no line break between variable declaration and other groups of statement (everything is lumped together).
2-spaces is the norm. The line break style varies a little more, but your example doesn't look out of place to me as someone who uses nim a lot for personal projects and Python for my day job.
I think it's just cultural shock. Because it's hard to distinguish nestings with 2-spaces for someone like me used to TAB identations, and they had good reason to stick with it.
Tbh, the example code you gave me is much more tidied up with clear separation between logical groups of statement and some comments sprawled around to guide on the control flow.
I have a hobby nim project at about 22K LOC, stdlib only. A quick and naive llm rewrite to nimony gave a ×1.3 runtime speed up. Pretty cool, will definitely keep up on nimony's development.
IIRC, ref counting is at least more deterministic than traditional GC because it only runs when you destruct the object (it goes out scope, object gets reassigned whatnot).
In Comparison, traditional GCs like JVM runs on a background thread, it's hard to determine when they run and generally blocks the whole program while collecting (stop-the-world).
So at least they are a little better in that regard?
I can’t speak of Nim’s implementation but reference counting can block the whole program as large object graphs have to decrement their counts. But you are right it is more deterministic.
Javas modern GCs also have extremely low pauses. ZGC is effectively pauseless, you’re likely to experience kernel jitter/traps that last longer than a ZGC pause.
ref counting is only performed if you use `ref` types, e.g.
type
RefObj = ref object
foo: string
bar: int
ValueObj = object
foo: string
bar: int
`RefObj` is ref counted equivalent to a shared_ptr in C++ land (non-atomic counter unless using --mm:atomicArc or Nim3/Nimony has this as a default I believe). `ValueObj` is equivalent to struct in C, C++, etc.
Nim has opt-in RC using the `ref` keyword; the default is stack-managed single-owner lifetimes, including for heap types. Passing is borrowing by default, while moving must be explicit; the vice-versa to Rust's approach. Data is technically cleaned up by the RC's procedures, but the destroy hooks are always called at the end of scope. And like I said, `ref` or `ptr` short-circuits that.
Right, but those can still run more advanced instruction sets, like 686. The OP didn’t say 32-bit but rather 386. Just 386 means not just 32-bit but also the original 386 instruction set from 1986 with none of the modern extensions.
Ha, that is bad. This is what happens when you use the cheap LLMs. (At least, I hope Opus 5.5 isn't pulling stunts that are this bad... It's not that bad when I look at my code.)
Personally i like the site's design, it looks like from late 2000s / early 2010s with its gradient rounded buttons, 1px offsets and chiseled text - i even clicked randomly on buttons because of how "buttony" they look :-P.
IME this isn't what LLMs make by default, so if nothing else, i doubt it was a single prompt and most likely it was adjusted to fit the author's taste (that it sounds like doesn't align with yours).
I think there was very little effort put on this specific website. The effort has gone in the compiler itself (and the mainline compiler). Not that it would not benefit for a better website
This feels archaic to me after seeing what is possible with Stricta. You get full Python syntax as low level as possible, safe, strict, no ARC/GC, memory access. https://github.com/lucianmarin/stricta
No need for that, I checked it, it's a good little language but not near Rust or Nim
The way you designed bound checking, parameter inferences is more a source of bugs than anything
I didn't see support for advanced closures and how it's integrated with the borrow checker (since you claim not having lifetimes, there are tons of unanswered questions in your thing)
Your desing of generic instantiation is just a compile time pit.
You don't constraint type so you need to check the body of every instance
You have NLL yeah, but not partial borrows nor the capacity for a proc to return one of it's parameters (the famous example
```rs
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { x } else { y }
}
```
since you don't have lifetimes, either you refuse this case or it's a bug
if you do a copy then your language asks it's user to use value semantics
But if your language mostly push users to value semantics (a.k.a copying tons of things) then why all the borrow stuff ? If there is no lifetime how is one suposed to store references ? why is there a ref, ref_mut type ?
Those are overly convoluted choices for a value based language
So it's a bit of an incoherence
Next there is the way you handle indexing
your spec state that undecided index access generate stricta_bounds_fail, but this function just output an error and exit the process, it doesn't insert a runtime check
So undecided index access act as nuke in the codebase, the users is not even aware that one of it's access is undecided, and when he expect it the less he just get the process stopped, no exceptions, just a crash
Then you don't even correctly handle cyclic data type structure, you defined in the codebase an arbitrary depth of 16 instead of checking type cycle (and what you stated in your spec just worked auto referencing types like type A with a field of type A again
Finally I don't understand whant Stricta is supposed to achieve.
Is it a stricter python ? If it's the case then why doesn't talk about compatibility ? why does it diverge from python on the semantic side ?
If it's just python like... then why the pythonish choices ? like hardcoded python types and OOP ?
As a control, writing r = xs[0].ref directly causes the compiler to reject del xs with cannot mutate 'xs' while it is borrowed. The hole is specifically across the
call boundary.
So: no open research problem was solved here. Parameter modes are insufficient; returned references need lifetime/region relationships equivalent to Rust’s:
```rust
fn head<'a>(xs: &'a [i64]) -> &'a i64
```
Until those constraints propagate through calls, the “Rust-style memory safety” claim is false.
Thanks, Andreas Rumpf, for sticking with it for all these years: This seems like a great opportunity for me to get back into nim.