Earlier quoted context omitted.
You can estimate cost of CEL program using static analysis before running it. "estimate" only because size of runtime data is generally unknown (but obv you could limit that).
"You can" - in theory, or does this actually exist?
Show HN: CEL by Example
31–40 of 41 posts
Re: Show HN: CEL by Example
#32Earlier quoted context omitted.
Ease/ability to embed in other language safely. Predictability of memory, execution. Known constraints like guaranteed to terminate is useful. no Doom running on cel. I recently wanted to expose some basic user auto tagging/labeling based on the json data. I chose cel, over python, SQL because I could just import the runtime in C++, or any language that implements it (python, js etc..) Safely running a sandboxed pyth…
> Known constraints like guaranteed to terminate is useful. "Guaranteed to terminate" actually means "guaranteed to terminate in finite but possibly arbitrarily large time" which is really not a useful property. There's no practical difference between a filter that might take 1 billion years to run and one that might take more than a billion years.
https://github.com/google/cel-spec/blob/master/doc/langdef.m...
And your service puts an upper bound on input size and cel expression size. (True for all practical applications.)
You can actually get a guarantee tha t you can't construct a billion year expression. And even guarantee that all expressions will evaluate in let's say 60 secs.
Turing completeness by itself does not guarantee this but it is a necessary prerequisite for these guarantees.
Re: Show HN: CEL by Example
#33I wrote the playground and I should link to your website in my docs. This is neat.
Re: Show HN: CEL by Example
#34Earlier quoted context omitted.
You can estimate cost of CEL program using static analysis before running it. "estimate" only because size of runtime data is generally unknown (but obv you could limit that).
"You can" - in theory, or does this actually exist?
Re: Show HN: CEL by Example
#35Does CEL have any way to import other files? i.e. could it serve as a general purpose config language like jsonnet?
Re: Show HN: CEL by Example
#36Yes you can embed other languages however constraining evaluation costs is not a first class feature.
Re: Show HN: CEL by Example
#37CEL is used a lot in FHIR as Path Expressions
Re: Show HN: CEL by Example
#38I would love if languages like Scala, Swift or F# had something like Cel but running at compile time so your program was evaluated against those restrictions. I believe a language called Idris has something like this
Are you suggesting to compile CEL into native code and run the compiled code at runtime (i.e. as a predicate function)? I think this is doable and I vaguely remember this was how it's implemented initially. But most use cases are treating CEL as a user provided config, which requires runtime parsing and execution.
type MyType{ myName: string where size > 8, year: number where number > 2000 }
Then, whenever this type is used, at compile time, an evaluation is done to ensure that the type restrictions are enforced.
Re: Show HN: CEL by Example
#39Earlier quoted context omitted.
You can estimate cost of CEL program using static analysis before running it. "estimate" only because size of runtime data is generally unknown (but obv you could limit that).
"You can" - in theory, or does this actually exist?