Hacker News new | ask | show | jobs
by 0atman 1090 days ago
Nim is too timid. Most languages are too timid.

My context: I'm a maintainer of iNim, creator of the Rust channel, No Boilerplate, and a professional python web developer for 15 years.

The features you are excited about in Nim are compromised for the sake of simplicity:

- Macros can't change syntax,

- There's a limit to how real-time the standard language is,

- Compiling to javascript is a nice trick, but if it didn't rely on GC it could compile to webassembly, which is better,

- Ask any advanced python developer: Indentation for syntax is a bad idea at scale. Hell, have you ever used YAML?

What Rust does is a revolution because they solved the problem of memory safety without garbage collection with the Borrow Checker. The knock-on effects are GARGANTUAN.

This was a hard problem to solve, and it makes the language more complex to learn, but it unlocks all the language's superpowers. If you 'cheat' with a GC, you get nothing. Nim started its life, just as most languages did with a GC, and the efforts to keep the syntax the same while offering alternatives are greatly compromised. It's far easier to add GC/RC to a low-level language than it is to remove it from a high-level one, where the whole ecosystem relies upon this behvaviour.

Of COURSE I know about Nim's plugabble GC options. That doesn't impress me at all (though Araq's effort is to be commended). In Nim they are compiler options, in Rust they're libraries. The difference is vital. For example, at a per-variable level, I can choose to reference count with https://doc.rust-lang.org/std/sync/struct.Arc.html if I so wish (I rarely need to because the borrow checker is magic).

If you want python, you can have it inside a Rust macro, sort of like this https://crates.io/crates/inline-python because rust macros CAN change syntax. With Macros and no GC, you can rebuild ANY FEATURE inside Rust, the floor of the abstraction is the metal, and the ceiling is the sky.

This is what Rust is all about: full power to the developer, no compromises. My video on this topic for those interested is: https://www.youtube.com/watch?v=PuMXWc0xrK0

I love both languages, but I can only see one language being the standard next 40 years, and demonstrably so can Linux, Microsoft, Cloudflare, Discord, and many others.

2 comments

Rust people talking about 'revolutions' love to ignore that memory safe languages without garbage collectors have been around for years. Ada+Spark, Cyclone, even D all made large steps forward in this area long before Rust was ever a thing.
Popularity counts. Find all those languages in this graph, then find rust. https://redmonk.com/sogrady/2023/05/16/language-rankings-1-2...
If popularity is what counts, then Rust is only a revolution in marketing and evangelizing.
Linus Tovalds is not an easy man to please. You're saying he's been fooled by marketing?

Sometimes tech is really good, dude, it's ok, don't die on a weird hill, not everything is shit.

I don't think Linus was pleased or fooled. I think that there hasn't been a bunch of eager beavers trying to write Linux drivers in other languages until Rust.
C++ was rejected as a driver language. All those other languages you mentioned also are also not suitable. Why could this be?
The problem with WebAssembly isn't that Nim couldn't compile to it (which it can), but that WebAssembly can't do anything without JavaScript.
WebAssembly is not just for the web. Please take a look at wasmtime[1], wasmer[2]. It's the future of computing.

You might want to read this iconic tweet[3]

[1]: https://wasmtime.dev [2]: https://wasmer.io [3]: https://twitter.com/solomonstre/status/1111004913222324225

We're not talking about hypotheticals. Rust wasm is used in production now. https://developers.cloudflare.com/workers/tutorials/hello-wo...

Emscripten and experimental backends hardly count as support for Nim. Python can run in webassembly by the same token, but no one would. The standard rust compiler compiles directly to webassembly, natively, with the stable toolchain.

In other languages, yes, the js bridge is a problem. However, not only will this be fixed in browsers at some point, but rust is so fast that TODAY yew.rs, a mature wasm framework, is faster than react.

My thoughts are better explained in this video https://youtu.be/P4LMfkFLRsI

Doesn't Rust with WebAssembly require any JavaScript to run?

If not, can you show me a webpage that uses WebAssembly and doesn't contain any JavaScript?

If yes, what is the advantage over just compiling to JavaScript?

> However, not only will this be fixed in browsers at some point,

This has been promised for several years, and is still nowhere to be seen.

> yew.rs, a mature wasm framework, is faster than react.

Being faster than React is not a high bar.

My apologies, it's faster than svelte, not just react: https://www.youtube.com/watch?v=4KtotxNAwME