Native regions: a borrow-checked sublanguage inside Clojure
6 points by Yogthos
6 points by Yogthos
I like the API of calling the types in native. What others did you think of and reject? I've been wracking my brains with different approaches for this for months with declarative-dsls. Of course, it's different, the C side and not sensible for small data. Currently I have compress optionally take specific columns to narrow as tightly as possible, without the user knowing about them, or (va/from :uint8 [1 2 3 4]) to do specific casts. Wrapping it as a macro instead seems quite nice! (I have a select-fast macro which does some of this work but...)
A couple of other ideas for a name that I had were kernel or compile-region, but native felt like it captured the gist of it the best. And I figured since type hints are already a thing, why not use them to declare the types for the region.
Incidentally, I also had a very similar idea to the declarative-dsls with relatum. Using a relational store as the in-memory representation can work really well as a data model for a lot of apps.
relatum
Oh! Your surface and use-case is quite different, so maybe not, but I am single minded: If you took declarative-dsls' design into account, what aspects did you like or dislike (especially re: the "SQL-ish DDL")?
My thoughts on yours: I'm only passingly familiar with relic (and maybe half of this is just copying that but), (allowing db types like varchar is interesting), and I'm surprised you opted for putting every part (:from, :where etc.) in arrays. I thought jolt docs/verify.clj would read source code and execute examples directly, which is inspiring if sadly not the actual case. What workflows do you have with this? Persisting typed data in csv, reading it back etc. and not bothering with an actual db?
The graph part looks very cool! The constraints part looks very interesting too - I'd explored similar, though I forget why I decided against it. (I do implicitly require/assume shared types lest performance collapses.) (A different library on top of declarative-dsls sort of does it, but I'm slowly porting it to deft's type system.)