| > Safety-critical field has done that with both C++ and Java for some time now. Every company/project uses a subset of C++ for a variety of reasons. The problem is, all those subsets are different, and as a result, if you want to rely on the ecosystem, you eventually have to deal with the entire language. Maybe you avoid exceptions/pointers/new&delete/template-meta-programming/the-coprocessor, but the libraries you need don't. This is visible already in Nim, where the GC is optional, but most libraries (and most of the standard library) does depend on it. It works well without GC, but you lose out on most of the existing libraries and many parts of the ecosystem. > Regarding that, does Nim allow one to turn off GC, mess with pointers, and twiddle bits like in C? It lets you twiddle bits without having to turn off the GC - it has GC-tracked pointers ("ref"s) and non-GC ones ("ptr"s). the GC is per-thread, with time limits but it can also be turned off. > Or improve with macros, type-safe wrappers, and so on? Nim macros are not quite at the Lisp level, but they are extremely powerful. There are various features for type safety that DON'T require wrappers, e.g. you could define "meters" and "yards" as two distinct 64-bit double types, which means you can't add them or assign one to a variable of the other kind, even though they are still essentially a C-style typedef. This is a much more elegant solution than the C++/Python/SmallTalk/Java/C# crowd, where you have to define a class with a lot of methods, which is still clunky, and hope that the compiler will be able to optimize it back down to a plain old double. |
I'm not fully familiar with Lisp macros so I'm curious, what is Nim missing that Lisp has in terms of metaprogramming?