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

Is it possible to use overloads? #1

Open
divan opened this issue Apr 11, 2023 · 2 comments
Open

Is it possible to use overloads? #1

divan opened this issue Apr 11, 2023 · 2 comments

Comments

@divan
Copy link

divan commented Apr 11, 2023

Hi, I'm trying to understand if it's possible to use this library with existing expressions from cel-go. In cel-go it's possible to declare custom functions (overloads) and use in expressions. README says that this project doesn't support passing custom environment options. Does it also mean that it's not possible to specify overloads?
If so, any plans to implement it?

@atn832
Copy link
Owner

atn832 commented Apr 11, 2023

You're right. So far the only Environment one can use is

/// Creates a program environment configured with the standard library of CEL
/// functions and macros. The Env value returned can parse and check any CEL
/// program which builds upon the core features documented in the CEL
/// specification. See
/// https://github.com/google/cel-go/blob/9e14003d8a7a856b250c5e6514647dee7d4fd9a2/cel/env.go#L127.
/// In cel-dart, it is not entirely standard as we do not support timestamp
/// protos nor macros.
Environment.standard()
: this._(environmentOptions: [StandardLibrary().toEnvironmentOption()]);

And indeed, it also means you can't specify overloads yet.

What specific expressions from cel-go are you trying to run?

There seems to be some demand for it. Perhaps a contributor or myself could build it. See atn832/fake_firebase_security_rules#2.

@divan
Copy link
Author

divan commented Apr 11, 2023

@atn832 thanks for quick answer. Well, I'm yet exploring if CEL fits my needs or not. My use case is not related to networking, it's pretty custom stuff, so I probably need some custom methods/functions. Like one of the stuff I was implementing in cel-go veriant is "trimmed mean" function. Basically find min and max values in the int list, drop them, and calculate mean.

As I said, CEL might not be a good fit for my case, though I really like philosophy of it and approach, but I'm looking for something that will work both for Go and Dart, hence the question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants