> D can also use C and C++ libraries (including templates), and with gcc and llvm it covers pretty much all the same architectures/platforms as nim.
Thank you for the suggestion. It turns out to be correct. Obviously there is a huge amount of progress since the last times I had been looking at D, before more than 7 years. (https://dlang.org/spec/cpp_interface.html) Still the D way looks to me more inconvenient by requiring you to include the class internals into the D binding. Example from the D manual:
extern(C++):
struct Foo(T)
{
private:
T field;
public:
@disable this();
T get();
void set(T t);
}
Nim requires you only to mention the name of the class (template) and the public part of the interface which you actually going to use. Example from the Nim manual (
https://nim-lang.org/docs/manual.html#importjs-pragma-import...).
type StdMap {.importcpp: "std::map", header: "".} [K, V] = object
proc `[]=`[K, V](this: var StdMap[K, V]; key: K; val: V) {.importcpp: "#[#] = #", header: "".}
var x: StdMap[cint, cdouble]
x[6] = 91.4
> with gcc and llvm it covers pretty much all the same architectures/platforms as nim
I am not sure whether they cover some really old platforms. By compiling to C you can target pretty much every platform which have a C89 standard conforming compiler.
A day ago I asked in the Dlang forum (https://forum.dlang.org/post/nmwinrjavfumvxffptxy@forum.dlan...) whether it is possible to develop in D for video game consoles, not only current generation which Remedy Games do for example, but also a few generations back. It turns out to not be completely clear, because maybe no one has tried it, but it was suggested that even if possible, probably it would require a considerable amount of tinkering. I don't know whether someone tried this in Nim but it seems to me, that by compiling to C89 or C++98, it would not be much an issue for every platform with a conforming compiler for these languages.