Live data from Hacker News

Show HN: CEL by Example

celbyexample.com

21–30 of 41 posts

Re: Show HN: CEL by Example

#21

Earlier quoted context omitted.

What you really want is "can be completed after a certain amount of time", not "can be cancelled". You don't want iam policy rules to be skipped because they took too long.

Well CEL doesn't offer that guarantee. For any given "certain amount of time" you can write a CEL filter that takes longer.

See my other comment - you can refuse to accept CEL filters that take too long to begin with.

Re: Show HN: CEL by Example

#22

Does CEL have any way to import other files? i.e. could it serve as a general purpose config language like jsonnet?

It's not really a configuration language like Jsonnet and CUE. It's an expression language for specifying things like conditions and policies. You _could_ abuse it as a configuration language, but it'd be overkill.

Yup, it's really a good fit for simple constraints eg in IAM systems. Give user X permission to do Y, but subject to some CEL expression like date comparison (auto-expiring grants), resource path prefix or similar.

Re: Show HN: CEL by Example

#23

I 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

A better solution would be first-class metaprogramming, like in Zig or LISP. Maybe with some subset which guarantees to halt (I.e. no unbounded loops, no recursion, no FFI, known input size, hard time limits, etc.)

Re: Show HN: CEL by Example

#24
post #7

It seems weird to require an entirely new programming language for this tbh. They make the claim that it is special because it's not Turing-complete, but that's nonsense. Turing completeness is almost never a property that is important. I think in this case they're equating Turing incompleteness with "doesn't take a long time to execute" but that isn't really the case at all. The property you really want is "can be c…

Say “halting problem” without saying “halting problem” ;)

There is a practical solution to it called “metering”, like gas mechanism in Ethereum’s EVM or cost calculation for complex GraphQL queries.

Re: Show HN: CEL by Example

#25
post #7

It seems weird to require an entirely new programming language for this tbh. They make the claim that it is special because it's not Turing-complete, but that's nonsense. Turing completeness is almost never a property that is important. I think in this case they're equating Turing incompleteness with "doesn't take a long time to execute" but that isn't really the case at all. The property you really want is "can be c…

Say “halting problem” without saying “halting problem” ;) There is a practical solution to it called “metering”, like gas mechanism in Ethereum’s EVM or cost calculation for complex GraphQL queries.

Yeah I think it's typically called "fuel".

Re: Show HN: CEL by Example

#26

Earlier quoted context omitted.

What you really want is "can be completed after a certain amount of time", not "can be cancelled". You don't want iam policy rules to be skipped because they took too long.

Well CEL doesn't offer that guarantee. For any given "certain amount of time" you can write a CEL filter that takes longer.

Correct, but you can also reject filters that will take longer statically. The point is not "any arbitrary CEL program will run in less than 10us", it's that I can encode "do not allow filters that take more than 10us to evaluate" an then have a very high degree of confidence that that will be true for any user provided filter that is accepted (and if I'm wrong it'll be...11us, not 5s)

In the common use-cases for CEL that I've seen, you don't want to skip evaluation and fail open or closed arbitrarily. That can mean things like "abusive user gets access to data they should not be allowed to access because rule evaluation was skipped".

You also may have tons of rules and be evaluating them very often, so speed is important.

Re: Show HN: CEL by Example

#27

I 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.

Re: Show HN: CEL by Example

#28
I think people commenting misunderstood what CEL offers.

Remember the famous https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule?

> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.

CEL is a well specified, reasonably fast "embeddable" language with familiar syntax. I'm sure there are other languages that fits the description though.

Re: Show HN: CEL by Example

#29
post #7

It seems weird to require an entirely new programming language for this tbh. They make the claim that it is special because it's not Turing-complete, but that's nonsense. Turing completeness is almost never a property that is important. I think in this case they're equating Turing incompleteness with "doesn't take a long time to execute" but that isn't really the case at all. The property you really want is "can be c…

Query DSLs are designed to simplify query planning by intentionally avoiding certain language features. You have many different choices on how to execute a query - in SQL for example, there's table scans, index seeks/scans, joins, etc. and you can execute them in different order. By being able to analyze the query upfront you can estimate the relative costs of different plans and choose the best one. Less powerful languages result in more predictable estimates because they're simpler to analyze.

Re: Show HN: CEL by Example

#30

Earlier quoted context omitted.

Right but "guaranteed to terminate" is not a useful property. You could write a program that terminates... after a billion years.

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?
Post reply on HN