News for hackers. Stuff that matters.
Re:Nim in 2020: A Short Recap by andybak on Thursday December 31, 2020 @07:13AM (#25591954)
How does karax run Nim client side? Cross compile to js or a wasm blob? Or something else entirely?
Re:Nim in 2020: A Short Recap by planetis on Thursday December 31, 2020 @07:37AM (#25592086)
Nim compiles to js with `nim js source`. I'm not familiar with wasm but it's also possible, know people who have done that.
Re:Nim in 2020: A Short Recap by shirleyquirk on Thursday December 31, 2020 @07:39AM (#25592100)
Nim compiles to js (as well as c and c++)
Re:Nim in 2020: A Short Recap by magicalhippo on Thursday December 31, 2020 @08:03AM (#25592248)
How much of C and the standard library does it use?

Like, if I wanted to make my own C compiler, how much would I have to implement for it to be usable with Nim-generated code?

Does it use a fairly constrained subset or does it use a lot of C and the standard library?

I imagine the latter but just curious.

Re:Nim in 2020: A Short Recap by cb321 on Thursday December 31, 2020 @08:20AM (#25592379)
Well, it works with TinyCC/tcc where you can get order 200 millisecond compiles. While tcc does do most of c99, I do not think Nim requires anything past c89. libc-wise, it doesn't use even all of standard C. Minimal stdio/string stuff. You can easily access any C libs, though. So, a given program may have more dependency, but that is up to you (or to your Nim package deps).

Full disclosure, not everything works - different backends tend to have slightly different bugs/coverage, but this also applies to c++ and js backends. But I use tcc as my default backend (in my nim.cfg file) every day and only run into problems like a time or two per year.

Re:Nim in 2020: A Short Recap by beagle3 on Thursday December 31, 2020 @08:22AM (#25592398)
Doesn't depend much on the standard library -- almost not at all, and usually behind flag (e.g., if you don't -d:useMalloc , nim will not us malloc).

I think it's no longer maintained, but there's a kernel that boots on metal written in Nim. Furthermore, people are running Nim on ESP32, Nintendo Switch, JS (Browser, Node), iOS, Android and more; From that alone its clear that the C library can't be a significant dependency.

(And ... just about any C compiler around, including GCC, LLVM, TCC, MS C, Intel C, Zig C are supported when using C as a backend).

Re:Nim in 2020: A Short Recap by pjmlp on Thursday December 31, 2020 @08:24AM (#25592423)
It is just a convenience, Objective-C and C++ also generated code like that on the early days.