Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
constantine
Constantine: modular, high-performance, zero-dependency cryptography stack for proof systems and blockchain protocols.
-
Arraymancer
A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends
FYI here are the instructions: https://github.com/dlang-tour/english (and forum: https://forum.dlang.org/post/[email protected]...)
In a word, yes.
In more words: You should be able to use Cosmopolitan libc: https://github.com/Yardanico/cosmonim
If something does not work for you, Yardanico is super duper helpful in all things Nim.
Nim also compiles to Javascript (nim js) and C++ for integration with legacy codebases, but that is probably more to the side of your interests.
This plugin has been worked on and the issue could have been fixed by now. I rarely used VSCode for D because the language doesn're really need an IDE support like Java or Scala. But I do agree that for beginners and IDE support is important. I use vim with DCD: https://github.com/dlang-community/DCD
A well written and absolutely gripping & interesting tale, also discussed here at the time (including by the blog author) https://news.ycombinator.com/item?id=1174912 and re-posted many times without as much ( https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que... ).
Particularly striking was how concurrent innovations like copper tools, steam boats, and milk pasteurization derailed only partially developed scurvy theory. One wonders if this story was part of Woody Allen's joke in _Sleeper_ about steak being found to be good for you.[1] { Probably more the constant thrashing about that has infected nutrition science since forever, though. }
[1] https://www.youtube.com/watch?v=1yCeFmn_e2c
> kernel developers do not allow third party runtimes in the kernel. Even meager Rust's "panic" runtime is a contentious
Much in Linux is contentious :-) which is why the module system is nice. A kernel module for C code requires no permission from Linux-core unless you need it distributed with the kernel (which, yes, might be required for "credibility" - but critically also might not). It may require many decls to access various kernel APIs, but those can be (semi-)automated or just done as-needed. So, Linux kernel policy is not so relevant (at best) which is what I meant by "no special support" (admittedly brief). Kernel coding is always a bit trickier, and you may need to build up some support code to make integration nice, though as well as decl generators.
> Can one disable runtime in Nim completely -- no GC, no exceptions?
To answer your question, and as discussed elsewhere in this subthread, Nim has many options for memory management.. only stdlib seq/string really needs automatic methods. One can disable the runtime completely via os:standalone and statically check that no exceptions are raised with Nim's effect system (and there are also both setjmp & goto based exception impls which may/may not be workable in Linux/BSD kernel module settings). As "proof more by example", a few people have written OS kernels in Nim recently[1,2] and there was another toy kernel long ago[3].
People have also written OS kernels in Go which "has a GC and runtime".[4] So, I acknowledge it's not quite the same example, but I also see no fundamental blockers for kernel modules.
[1] https://github.com/khaledh/axiom
[2] https://prosepoetrycode.potterpcs.net/2023/01/a-barebones-ke...
[3] https://github.com/dom96/nimkernel
[4] https://github.com/mit-pdos/biscuit/
> kernel developers do not allow third party runtimes in the kernel. Even meager Rust's "panic" runtime is a contentious
Much in Linux is contentious :-) which is why the module system is nice. A kernel module for C code requires no permission from Linux-core unless you need it distributed with the kernel (which, yes, might be required for "credibility" - but critically also might not). It may require many decls to access various kernel APIs, but those can be (semi-)automated or just done as-needed. So, Linux kernel policy is not so relevant (at best) which is what I meant by "no special support" (admittedly brief). Kernel coding is always a bit trickier, and you may need to build up some support code to make integration nice, though as well as decl generators.
> Can one disable runtime in Nim completely -- no GC, no exceptions?
To answer your question, and as discussed elsewhere in this subthread, Nim has many options for memory management.. only stdlib seq/string really needs automatic methods. One can disable the runtime completely via os:standalone and statically check that no exceptions are raised with Nim's effect system (and there are also both setjmp & goto based exception impls which may/may not be workable in Linux/BSD kernel module settings). As "proof more by example", a few people have written OS kernels in Nim recently[1,2] and there was another toy kernel long ago[3].
People have also written OS kernels in Go which "has a GC and runtime".[4] So, I acknowledge it's not quite the same example, but I also see no fundamental blockers for kernel modules.
[1] https://github.com/khaledh/axiom
[2] https://prosepoetrycode.potterpcs.net/2023/01/a-barebones-ke...
[3] https://github.com/dom96/nimkernel
[4] https://github.com/mit-pdos/biscuit/
D has a language server (LSP) you can use any IDE/editor that supports it
- Sublime Text
- vscode
- vim/nvim
- emacs
etc..
https://github.com/Pure-D/serve-d/
`when myCondition():` instead of `if myCondition:` is done at compile-time.
Alternatively you can use a `static:` code block to force compile time evaluation. Or tag a function {.compileTime.} or tag function inputs with `static` modifier.
It is possible to create a compiler or an assembler running fully in Nim macros as well:
- https://github.com/mratsim/constantine/blob/master/constanti... (all that file runs at compile-time)
You can also implement Continuation-Passing-Style transformation at compile-time:
- https://github.com/nim-works/cps
Or a neural network DSL or for a self-contained example, einsum:
- https://github.com/mratsim/Arraymancer/blob/master/src/array...
It's worth noting that nim async/await transformation is fully implemented as a library in macros.
Why go through all the trouble when you can do this: https://www.hylo-lang.org/ and not spend a second thinking of lifetimes? No, copies will not be issued unless necessary.
Or why not keep exploring this idea as well? More research-oriented than the first one right now, though, so take it with a grain of salt: https://vale.dev/
Why go through all the trouble when you can do this: https://www.hylo-lang.org/ and not spend a second thinking of lifetimes? No, copies will not be issued unless necessary.
Or why not keep exploring this idea as well? More research-oriented than the first one right now, though, so take it with a grain of salt: https://vale.dev/
Related posts
- So I started learning about C++ and I feel like I'm doing everything wrong.
- CppCast: Dart and Crafting Interpreters
- OpenD, a D language fork that is open to your contributions
- Ask HN: Who is using the D language and likes/doesn't like it? Why?
- Why is Zig so much more successful than Crystal and Nim?