juji-io / datalevin

A simple, fast and versatile Datalog database
https://github.com/juji-io/datalevin
Eclipse Public License 1.0
1.15k stars 63 forks source link

Datalevin as a C Shared library #37

Open huahaiy opened 3 years ago

huahaiy commented 3 years ago

For other languages to use Datalevin, it is ideal to make Datalevin a C shared library. However, it is inconvenient to use Datalevin if there is no C library that can handle EDN data. It is OK to treat query/transaction input as plain text, but it would be much more convenient if the results could be consumed by C easily. Unfortunately, there's no C library for EDN data. Another option is for Datalevin to output JSON results instead, with inevitable loss of type information.

I think this problem does not just affect Datalevin, but also the whole Clojure ecosystem. The adoption of Clojure is hindered by the lack of interoperability with the native world, which is primarily built on top of C. An EDN C library would hugely alleviate this problem.

huahaiy commented 3 years ago

Related discussions on https://clojureverse.org/t/clojure-interoperability-with-the-native-world/7277

huahaiy commented 3 years ago

See also https://github.com/cnuernber/dtype-next

theSherwood commented 3 years ago

@huahaiy What you describe fits my situation exactly. I'm seriously wanting to use Datalevin but don't want to have to use Clojure to do it. A C library would be amazing.

Have you seen this work on an EDN parser in C++? https://github.com/edporras/edn_turbo/tree/main/ext/edn_turbo

To be honest, I'd be nearly as happy with JSON output as the Clojure collection types don't really have C corollaries anyway.

huahaiy commented 1 year ago

We will go JSON route for this. See #182