vmware / differential-datalog

DDlog is a programming language for incremental computation. It is well suited for writing programs that continuously update their output in response to input changes. A DDlog programmer does not write incremental algorithms; instead they specify the desired input-output mapping in a declarative manner.
MIT License
1.37k stars 117 forks source link

Improve support for rust "FFI" #980

Open Kixiron opened 3 years ago

Kixiron commented 3 years ago

I've got no idea how things would work, but as-is writing rust alongside ddlog kinda sucks, especially if you write relation transformers. In an ideal scenario we'd check all these boxes:

Again I don't really know how we'd go about this, maybe we'd require external code to be a library crate supplied by the user that we connect to with ddlog or something which could be really advantageous for a number of reasons, such as being able to link multiple rust crates into a single ddlog module with this hypothetical syntax

#[path = "your_custom_crate_name::ddlog_ffi::foo_bar_baz"]
extern function foo_bar_baz(value: 'T)
ryzhyk commented 3 years ago

A straightforward generalization of the current design would be to allow a directory containing a Rust crate per DDlog module.

Kixiron commented 3 years ago

That'd definitely be nice, but it still suffers from the problems of tooling not working properly

ryzhyk commented 3 years ago

If the Rust directory is a self-contained crate, there's no reason Rust tooling wouldn't work on it. But if it depends on Rust code generated from DDlog, one would have to run the ddlog compiler before running Rust tools.

Kixiron commented 3 years ago

Oh, I thought you were meaning to just extend it to a module and not a crate.

One would have to run the ddlog compiler before running Rust tools

Yah, unfortunately I don't really think there's a perfect solution