Skip to content
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

Support for closures #202

Open
wants to merge 22 commits into
base: v5
Choose a base branch
from
Open

Support for closures #202

wants to merge 22 commits into from

Conversation

divarvel
Copy link
Collaborator

@divarvel divarvel commented Dec 29, 2023

The goal of this branch is to explore how to add support for closures in the stack machine

  • closures are represented as a list of ops and a list of parameter names

  • closure parameters can be used like variables

  • variable names must be unique, so shadowing is forbidden

  • boolean operators use laziness and push the rhs closure on the ops list only if needed (without recursion)

  • .any() and .all() use recursion to compute results

  • closure support in datalog::expression::Op

  • closure support in format::schema

  • closure support in parser

  • closures for lazy boolean operators

  • closures for .any() and .all()

  • prevent shadowing in closure arguments

  • print And and Or with &&! and ||!, without parsing them.

  • v5 block detection depends on Add HeterogeneousEqual and HeterogeneousNotEqual to binary operation #220

divarvel and others added 4 commits December 29, 2023 11:01
- recursive closure evaluation
- no support for serialization nor parsing
instead of calling `Expression.evaluate` recursively, push the closure to the ops vector
no support for nested closures and proper parameter substitution yet
It also includes a list of parameter names for proper parameter evaluation
@Geal Geal changed the base branch from main to v5 May 22, 2024 11:35
Copy link

codspeed-hq bot commented May 26, 2024

CodSpeed Performance Report

Merging #202 will not alter performance

Comparing closures (fab2f24) with v5 (5bcac29)

Summary

✅ 12 untouched benchmarks

Copy link

codecov bot commented May 26, 2024

Codecov Report

Attention: Patch coverage is 51.36364% with 107 lines in your changes are missing coverage. Please review.

Project coverage is 58.13%. Comparing base (5bcac29) to head (fab2f24).

Files Patch % Lines
biscuit-auth/src/format/convert.rs 23.33% 69 Missing ⚠️
biscuit-parser/src/parser.rs 64.86% 13 Missing ⚠️
biscuit-auth/src/token/builder.rs 20.00% 12 Missing ⚠️
biscuit-auth/src/datalog/expression.rs 91.30% 6 Missing ⚠️
biscuit-parser/src/builder.rs 0.00% 5 Missing ⚠️
biscuit-auth/src/datalog/mod.rs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v5     #202      +/-   ##
==========================================
- Coverage   58.27%   58.13%   -0.15%     
==========================================
  Files          23       23              
  Lines        4664     4820     +156     
==========================================
+ Hits         2718     2802      +84     
- Misses       1946     2018      +72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@divarvel divarvel marked this pull request as ready for review May 26, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Implementation
Development

Successfully merging this pull request may close these issues.

None yet

2 participants