Thread overview
if you cannot beat them (Rust), then why not ... use them? :-) Ann: rust_interop_d and call for help
Jun 03, 2022
yl
Jun 03, 2022
Jack
Jun 03, 2022
Ali Çehreli
Jun 04, 2022
zjh
Jun 16, 2022
test123
June 03, 2022

Hi,

Rust has emerged as Linux’s second official language [0]. It's a clear win, and all the response from the big companies in the industry have been positive, e.g. [1].

D is trying to catch up, and Walter started the work on borrow checker ~3 years ago [2], but shall the D community wait for it? And even if it get into D, how much more man power are needed to build all these libraries [3]: 85,142 crates, 16,783,226,701 downloads? and how long you think it will take? Right now D has 2185 packages [4], by this rough estimate, the Rust community is ~40x time bigger than D's. (There is no total downloads stats on [4], so we do not know the actual D libraries usage).

While Walter is trying to join them, shall we D users ... use them ... now? :-) I think we should.

Rust has f.f.i to C, and there is a utility cbindgen [5] which can create C/C++11 headers for Rust libraries which expose a public C API; and on the D side, we have dpp [6] and dstep [7] to make D talks to C very easily. And of course, we also have -betterC :-)

So I just created this wrapper library to make those high performant, memory safe Rust library available to D users:

https://code.dlang.org/packages/rust_interop_d

and started with these 2 containers:

  • DashMap: is an implementation of a concurrent associative array/hashmap in Rust. dashmap-5.3.4 Blazing fast concurrent HashMap for Rust. [8]
  • SegQueue: An unbounded multi-producer multi-consumer queue. [9]

Since I'm new to Rust, I want to call for help / contributions if you know Rust and want to use some of their high quality libraries from D. Esp. since Rust does not have GC, those of you who want nogc D libraries now clearly have an alternative.

So, let's start D-Rusting :-)

[0] https://www.techzine.eu/news/devops/69453/rust-emerges-as-linuxs-second-official-language/
[1] https://msrc-blog.microsoft.com/2019/07/22/why-rust-for-safe-systems-programming/
[2] https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in-d/
[3] https://crates.io/
[4] https://code.dlang.org/
[5] https://github.com/eqrion/cbindgen
[6] https://code.dlang.org/packages/dpp
[7] https://code.dlang.org/packages/dstep
[8] https://docs.rs/dashmap/5.3.4/dashmap/struct.DashMap.html
[9] https://docs.rs/crossbeam-queue/0.3.5/crossbeam_queue/struct.SegQueue.html

June 03, 2022

On Friday, 3 June 2022 at 17:38:23 UTC, yl wrote:

>

Hi,

Rust has emerged as Linux’s second official language [0]. It's a clear win, and all the response from the big companies in the industry have been positive, e.g. [1].

[...]

well, if there's something that Rust is better but I can use D from D, hell yeah let's do it but i hope it's temporary tho

June 03, 2022
On 6/3/22 10:38, yl wrote:

> on the D side, we have dpp [6] and dstep [7] to make D talks to C
> very easily.

Now there is ImportC in the language, getting improved and bugs fixed:

  https://dlang.org/spec/importc.html

Ali

June 04, 2022

On Friday, 3 June 2022 at 17:38:23 UTC, yl wrote:

Yes, use rust to defeat rust.

June 16, 2022

On Friday, 3 June 2022 at 17:38:23 UTC, yl wrote:

>

Hi,

Rust has emerged as Linux’s second official language [0]. It's a clear win, and all the response from the big companies in the industry have been positive, e.g. [1].

just try your project, work very well.