People are allowed to have preferences. I have more fun writing Nim than 
writing Rust ¯\\_(ツ)_/¯.

Now let's address the rest:

> Rust is safer

Rust is less safe than Ada Sparks or Formally Verified C. There is a reason why 
on audit Rustls was recommended to switch to formally verified C primitives for 
cryptography: 
<https://github.com/rustls/rustls/blob/master/audit/TLS-01-report.pdf>

Nim also has a borrow checker via `lent` and `owned ref` semantics.

A borrow checker however only catches memory issues and data races. It doesn't 
catch design bugs or race conditions, you need formal verification for that 
(like Ada Spark).

Hopefully in the future Nim gets the Z3 theorem prover support (see 
[DrNim](https://nim-lang.org/docs/drnim.html)) and we can have primitives with 
mathematical proofs of correctness: 
<https://github.com/nim-lang/RFCs/issues/222>

By the way regarding safety, I don't understand the choice of default unsigned 
integer when those are a recipe for underflow bugs everytime you do a 
substraction, say `for a in 0..(vec.len - 2) {...}`

> and faster

I'm still waiting for:

  * Matrix multiplication in Rust faster than mine which achieve 97% to 102% 
throughput of almost pure Assembly OpenBLAS: 
<https://github.com/numforge/laser/blob/e23b5d6/benchmarks/gemm/gemm_bench_float32.nim#L393-L407>
  * state-of-the-art cryptography: <https://hackmd.io/@gnark/eccbench#Pairing> 
(This was before solving a Nim bug on parameter passing large objects)
  * Multithreading runtime for high-performance computing: 
<https://github.com/mratsim/weave>



Nim is probably the best language to develop domain-specific language and new 
languages in. It is excellent at rapid development and time to market with it's 
scripting feel.

Rust doesn't run on all hardware ISA as LLVM doesn't support all ISAs. All ISAs 
have a C compiler.

> Write a Rust wrapper should be much easier than develop a pure Nim library

So it should be easy for you to write an equivalent to my cryptography library?

<https://github.com/mratsim/constantine>, pro tips you need:

  * a compile-time assembler because GCC and LLVM don't know how to generate 
add-with-carry and are 70% slower than assembly on big int multiplication: 
<https://github.com/mratsim/constantine#compiler-caveats>
  * Working "integer generics" and "enum generics". Rust still doesn't have 
this key feature working reliably.
  * Higher-Kinded Types



I would also be interested to see a Rust high-performance computing and image 
manipulation library similar to 
<https://github.com/numforge/laser/tree/master/laser/lux_compiler/core> with 
codegen for parallel CPUs and GPUs and the possibility to setup vectorization 
(SSE, AVX, Neon), parallelization and other HPC goodies that can generate code 
at runtime or compile-time.

Pro tip: you need AST manipulation at compile-time, 
<https://github.com/numforge/laser/blob/master/laser/lux_compiler/core/lux_types.nim>

I would also be very interesting in a JIT compiler that doesn't do text 
interpolation for generating opcodes:

  * javascript in asmjit 
(<https://github.com/asmjit/asmjit/blob/2a706fd/tools/tablegen-x86.js>)
  * C++ in xbyak 
(<https://github.com/herumi/xbyak/blob/c79311a/gen/gen_code.cpp>)



Instead in Nim you can do everything in a clean macro, with proper checks of 
types and arguments: 
<https://github.com/mratsim/photon-jit/blob/747ae2d/photon_jit/x86_64/x86_64_ops.nim>

Reply via email to