←back to thread

Nim 2.2.6

(nim-lang.org)
159 points xz18r | 2 comments | | HN request time: 0.001s | source
Show context
didibus ◴[] No.45773810[source]
I had completely forgot about Nim. It was trending a while back, but now it seems all the fanfare is around Zig instead.
replies(1): >>45777308 #
1. seanw444 ◴[] No.45777308[source]
I wish for both to succeed. I'm more of a Nim guy, but it's nice that there is a modernized C-like alternative to C gaining traction.

My biggest complaint about both is the lack of built-in run-time polymorphism. Rust gets you comptime and runtime polymorphism in one complete package. Nim makes use of shallow inheritance, which I find hacky, because it only lets you go one level deep. And Zig's stdlib makes it the norm to construct vtables manually, which is absolutely grotesque in my opinion. Why are we manually creating vtables in a "modern" language in 2025?

replies(1): >>45778968 #
2. lerno ◴[] No.45778968[source]
I feel qualified to offer a guess as to why: in Zig (and Odin) reuse is mainly done through what basically is templates. This reduces the need for vtables only when true ”plugin” type of objects are the only solution. For Zig and Odin, the only stdlib usages are for allocators and streams. These few usecases are way too few to motivate a full fledged interface feature, and consequently it’s not added. So it’s both a lack of usecases, as well as a desire to prefer templates over interfaces for reuse, typically due to performance concerns.