News for hackers. Stuff that matters.
Re:Nimony: A New Compiler for Nim by jeremyjh on Tuesday November 17, 2026 @08:07AM (#50530853)
I wonder if this is more palatable with first-class sumtypes/ADTs in Nim 3? Or is that already what JsonNode essentially was?
Re:Nimony: A New Compiler for Nim by xigoi on Tuesday November 17, 2026 @02:40PM (#50537039)
Sum types already existed in Nim 2, but Nimony makes them more convenient to use.
Re:Nimony: A New Compiler for Nim by klibertp on Tuesday November 17, 2026 @07:57PM (#50540481)
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).