Rust <-> Racket Interop?

I have been looking for a language to interop with Rust where:

  1. low-level performance intensive code = Rust

  2. repl-like development = other language

I’ve come to really like Racket for it’s DSL support (https://beautifulracket.com/), basic support of types (https://docs.racket-lang.org/ts-guide/) and REPL development environment.

Unfortunately, I there seems to be no Rust <-> Racket interop crates ( https://crates.io/search?q=racket ).

Is anyone working on this? Are there fundamental issues about Rust runtime vs Racket runtime that makes this impractical ?

Don’t forget that Rust extern functions are actually extern "C", and are therefore exposing a C-Api.
So, if you want to expose an api to racket, you can use a c-api package for racket.
If you want to expose racket to rust, make the racket api expose a c-api.

1 Like

Looking at it, I don’t think there’s anything fundamental stopping this from existing. As @OptimisticPeach stated, rust can easily expose C apis. It looks like racket has native functionality for consuming C apis as well: https://docs.racket-lang.org/foreign/index.html.

There’s some past work with a much older version of rust at https://www.brinckerhoff.org/blog/2013/03/29/embedding-rust-in-racket/. The rust syntax is pre-1.0 and outdated, but I think the example could help.

The only piece missing in all this is a rust crate for easily constructing these bindings! And creating such a crate seems totally practical, it’s just that no one has done it yet.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.