4 ms·
For me, it's a full stack language, write the frontent with karax https://github.com/pragmagic/karax https://github.com/pragmagic/karax or react bindings https:
by planetis 6y ago
For me, it's a full stack language, write the frontent with karax https://github.com/pragmagic/karax https://github.com/pragmagic/karax or react bindings https://github.com/kristianmandrup/react-16.nim https://github.com/kristianmandrup/react-16.nim and backend in pure nim with any of the available web frameworks (jester/prologue/looper) and orms (ormin/norm) and share code and type declaration between the two.
- andybak 6y agoHow does karax run Nim client side? Cross compile to js or a wasm blob? Or something else entirely?
- planetis 6y agoNim compiles to js with `nim js source`. I'm not familiar with wasm but it's also possible, know people who have done that.
- shirleyquirk 6y agoNim compiles to js (as well as c and c++)
- magicalhippo 6y agoHow 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.
- cb321 6y agoWell, 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.
- beagle3 6y agoDoesn'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).
- pjmlp 6y agoIt is just a convenience, Objective-C and C++ also generated code like that on the early days.
- dom96 6y agoFor a real-life example of this check out NimForum: https://forum.nim-lang.org https://forum.nim-lang.org The front end is written with Karax (compiled to JS) and the backend with Jester.