All the productivity of a language like Python but with the performance of C.
All the productivity of a language like Python but with the performance of C.
I hope Jetbrains can prioritize the Clion plugin. It would help a lot.
Also basic usage of generics doesn't really work w/ the vs code plugin, which is the best one.
Good idea! I've made a proof-of-concept Neovim plugin: https://sr.ht/~xigoi/nvim-summon/
It wasn't difficult, so if you use a different editor, you can make one too (feel free to reuse my documentation scraper).
We'll see when I start my next nim project, how I can contribute..
All Go had to do was say, “Built by Google” and people came running.
Go is a nice language that gets a lot right. Saying people only use it because of Google is kinda shortsighted.
The language was saved from dying by AdWords, which had just migrated from GWT into AngularDart.
Key designers from Dart 1.0 eventually left Google, like Gilad and Lund.
Flutter gave it a new life, but also is the only reason to use Dart, Flutter apps.
Corporate marketing budget and related astroturfing.
More pithy ways to put it are that "there are no speed limits" or "Nim responds to optimization effort about as well as other low level languages like C". You can deploy SIMD intrinsics, for example. In my experience, it's not that hard to "pay only for what you use".
As a more concrete thing, I have timed (yes, on one CPU, one test case, etc..many caveats) the tokenizer used in https://github.com/c-blake/bu/blob/main/rp.nim to be faster than that used by the Rust xsv.
Of course, you really shouldn't tokenize a lot if it's costly/data is big, but rather save a binary answer that does not need parsing (or perhaps more accurately is natively parsed by the CPU).
My experience has been with basically translating Python and shell scripts into Nim, and occasionally comparing them with my own feeble attempts at doing the same in C.
The issue is that Nim's string library ends up making copies when doing things. It's a sane default and ensures sane behavior. However, it often leads beginner's to make slower programs, sometimes even slower than equivalent Python ones. If you used `strcopy` in C a lot, you'd get similar results.
Often the solution is trivial and is just to use the `var` or `openArray[T]` variants of proc's. It's one of the points in the blog post and is crucial for good real time code. I'm hopeful the new `lent` and `view` features will make it easier to use non-copy slices on strings. That'd be nice!
In other words, performance in Nim is entirely down to the algorithm used, which is a nice place to be.
- https://github.com/status-im/nwaku
- https://github.com/status-im/nimbus-eth2
But I think the real killer feature to me is the javascript target. It seems like a real dream for a fullstack experience.
Agree, this is amazing because you can share code and data structures between front and backend (for example: https://github.com/karaxnim/karax).
Also, it's really nice having high level stuff like metaprogramming and static typing spanning both targets. Things like reading a spec file and generating statically checked APIs for server/client is straightforward, which opens up a lot of possibilities.
Backend and frontend in the same language is a massive feature for many reasons, not least performance and uniformity. Adding TypeScript is increasing interface friction and complexity, instead of simplifying things.
Of course, right now this may or may not be easier/harder/feasible with just Nim depending on the project, and many more people know TypeScript, but the ideal of one language > many languages is a worthy one.
TypeScript already allows this, i.e. you can build the backend and frontend in one language (TypeScript). Same for most languages that compile to WASM.
My point is that with TypeScript this killer feature is already realised and in a way that is far more familiar to the many thousands of developers that already know JavaScript.
Sure, from the uniformity side, but what about performance?
It's not just latency performance either, it's resource performance and overheads, such as with embedded servers.
> with TypeScript this killer feature is already realised
It really depends on your requirements whether this is true. Personally, a systems language I can use for web stuff is more useful and has a wider scope to me than running JavaScript or WASM in a systems role, even though it is technically possible to do so.
Sure, for embedded it might not be workable, but again- since we're discussing killer features I think we need to think bigger. Embedded is far too small a niche to be considered to be Nim's killer feature, especially when this space is already dominated by Rust which supports WASM very well (and therefore hits the performance + uniformity you desire).
No, I'm well aware of JS and WASM performance, internals, and pitfalls.
> For 99.9% of use cases the performance is enough.
Again, it depends on your perspective and requirements. Statistically, PHP is enough for most people so why use TypeScript? At the edges of the resources bell curve however the details do matter. It's not enough to say that for those concerns you must use different language and potentially a whole different set of semantics, intricacies, libraries and workflows.
> I think we need to think bigger. Embedded is far too small a niche to be considered to be Nim's killer feature
That wasn't my point, and ironically you might be underestimating how much minimising power and resource usage drives much of the modern world. Memory/storage + CPU ticks == money.
My point is that a language that can act as a universal tool without sacrificing efficiency, productivity, or extensibility (via AST macros), is itself a 'killer feature'. Nim hits that sweet spot of being easy to read and write as well as 'close to the metal'. It lets me target JS, embedded, and natively interface with C and C++ ABI. That gives me a lot of options with one language. There are other languages that have some of these traits, but not all together in a nice package IMO.
> especially when this space is already dominated by Rust
You mean C?
In the context of our discussion PHP doesn't make sense as it doesn't have native support for running in the browser. TypeScript is specifically a good choice because it has been built with the browser and the backend in mind.
> you might be underestimating how much minimising power and resource usage drives much of the modern world. Memory/storage + CPU ticks == money.
I have learned over the years that what actually drives the modern world is pragmatism. Sure, performance matters, but when you have to reimplement hundreds of libraries from scratch because the ecosystem doesn't exist then you are losing far too much time (and your implementations of those libraries are likely to be suboptimal). You're better off losing some performance and picking the established language, so that you actually ship your project within a couple of months instead of a couple of years.
Nim has been going now for 15 years and has thus far failed to reach critical mass. With each year gaining that critical mass becomes less and less likely. A killer feature for Nim needs to be so beneficial that it overcomes the lacking ecosystem.
> You mean C?
I was referring to the space of languages that work well on embedded and in the browser. C doesn't support the browser side well.
Sure, if your only use case is web front/back end uniformity.
My use case covers web front and back end, but also custom embedded, HPC, ML, simulations, and a lot of other stuff that is simply not viable with TS/JS or WASM. This language lets me share abstractions and reuse code across all this stuff and use C/C++/JS/Python ecosystems directly.
All the above are possible with just JS. Yes, you can even run JS on a microcontroller: https://www.espruino.com/
The V8 JS/WASM engine, however, is written in C++ for good reason. TS/JS/WASM/web is built on people counting ticks and aligning bytes to give even the floppiest callback spaghetti of frameworks the overhead to be responsive as abstractions increase.
> I have learned over the years that what actually drives the modern world is pragmatism.
I agree, except I think it's more pragmatic to have one language that can service any industry. TS/JS ain't it, from my perspective.
> reimplement hundreds of libraries from scratch because the ecosystem doesn't exist then you are losing far too much time
Why would you reimplement libraries from scratch instead of using FFI? FFI is one of the many, apparently unrecognised, 'killer features'. Specifically killer is FFI with ABI compatibility to C++. The pragmatic approach is always to stand on the shoulders of giants and FFI with existing libraries for the reasons you listed.
I'm surprised to hear you say that to be honest as you've used the language for years. Is there an experience behind it?
> You're better off losing some performance and picking the established language, so that you actually ship your project within a couple of months instead of a couple of years.
Well, I don't disagree with the sentiment, but this is more of a commentary on the job market/cost of business than capability.
Again, though, it really depends what you're doing. Chucking out a web app for an internal tool and distributed websites have different requirements.
> Nim has been going now for 15 years and has thus far failed to reach critical mass. With each year gaining that critical mass becomes less and less likely.
This is a strange perspective to me. Programming languages aren't food left out of the fridge, they're tools to do a job.
Python was made in the 1980s and took decades to even be known about. Why did people start using Python? Because it was readable, convenient, and very productive. Why did it become popular? Because people used it more...
What you call 'critical mass' is just a visible hiring pool.
Companies need confidence to find or train people in the language, and developers need confidence they can pay their bills by learning it. Confidence is increased when people hear of business use, say, if FAANG started a some minor project with it, and it feeds back.
However Rust doesn't dominate embedded. That's still C or even C++.
Rust has a lot of embedded crates, but supports a pretty small subset of hardware given the number of crates and amount of effort poured into them. The trait system particularly sucks for modeling hardware, IMHO, and with the "re-write the world" mentality it means there's still quite a bit of pain.
So it seems rosier than it actually is -- for now. Rust on embedded is gaining momentum.
I don't disagree. What I meant specifically is that Rust dominates the space where you want to target embedded and the browser (Rust does well on embedded and has good WASM support). C/C++ does not support the browser well at all (you can say that it supports WASM too, but Rust has far more front-end frameworks that actually target the browser than C afaik).
I actually want to get Nim + WASM running on embedded so we could do our own MicroPython like setup and not require people to know how to flash the hardware directly.
I know Andreas doesn't care for WASM, but Nim could support native WASM relatively easily. It already does a "re-looper" for the JS backend AFAICT. which is the biggest challenge of WASM.
There are examples of rising languages that never had such corporate sponsorship, like Zig and Julia, but I actually can't think of one as successful as Rust/Go/Swift/etc.?