-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: datalog foreign function interface prototype #228
Draft
divarvel
wants to merge
7
commits into
v5
Choose a base branch
from
ffi
base: v5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CodSpeed Performance ReportMerging #228 will not alter performanceComparing Summary
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v5 #228 +/- ##
==========================================
+ Coverage 69.03% 69.58% +0.54%
==========================================
Files 25 25
Lines 5926 6154 +228
==========================================
+ Hits 4091 4282 +191
- Misses 1835 1872 +37 ☔ View full report in Codecov by Sentry. |
divarvel
force-pushed
the
ffi
branch
5 times, most recently
from
October 4, 2024 08:21
4f68cf3
to
949d273
Compare
divarvel
force-pushed
the
ffi
branch
6 times, most recently
from
October 25, 2024 13:20
c9a91d0
to
7d1297d
Compare
divarvel
force-pushed
the
ffi
branch
4 times, most recently
from
November 12, 2024 08:20
2daa976
to
90c6ca3
Compare
This allows using external functions in datalog. This makes it easy to provide custom logic without extending the spec for every use-case, at the expense of portability: behaviour is no longer guaranteed to be consistent cross languages, and some languages won’t be able to support it at all (for instance JS as of now). Todo: - stricter conversions from datalog - feature-gating if possible Open questions: - enum index for the FFI variants (contiguous or not?) - how to provide functions (right now, function pointers: prevent mutability and closing over arguments) - how to provide arguments (right now, datalog::Term, so symbols have to be resolved, and functions returning strings have to register new symbols)
- using boxed functions instead of function pointers allow capturing the environment - using builder terms instead of datalog terms remove the need for manual symbol management
Instead of storing strings directly in the ops, do as we do for everything else and use the symbol table. This required duplicating `biscuit_parser::builder::Binary` and `Unary` in the `biscuit_auth::builder` module (which previously used the definitions from the `datalog` module directly). There is a lot of duplication between `biscuit_parser::builder` and `biscuit_auth::builder`, with a circular-ish dependency (biscuit_auth depends on biscuit parser, but code generated by the `ToTokens` impl blocks in biscuit parser depend on `biscuit_auth::builder`).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows using external functions in datalog.
This makes it easy to provide custom logic without extending the spec for every use-case, at the expense of portability: behaviour is no longer guaranteed to be consistent cross languages, and some languages won’t be able to support it at all (for instance JS as of now).
Open questions:
Code coverage should be improved by adding samples