Live data from Hacker News

Common Expression Language

github.com

11–20 of 111 posts

Re: Common Expression Language

#11
post #10

Earlier quoted context omitted.

I'm an ardent supporter of executable config languages, especially for the infrastructure-as-code space (the only thing special about this space is that configs tend to be very large, so you're more likely to run into reuse issues), which markets itself as "it's just YAML!" but inevitably all of that copy/pasted YAML becomes unwieldy and you want reusability. At that point, you have a few distinct options: 1. Build a…

I am with you, I wish the world would just adopt Lua as their config files.

I haven't used Lua, but I've used Starlark extensively and I will say that static typing is a boon, especially in the infra-as-code space where the feedback loop can be very long.

Re: Common Expression Language

#14

This looks really similar to Open Policy Agent[0], wonder how they compare. [0]: https://www.openpolicyagent.org/

I'll let Tristan or Torin comment more authoritatively, but back in 2017/8 CEL partnered with OPA and I believe CEL was used as the basis for expressions in their new version of Rego.

I left the team about that time, so I don't know what exactly happened after that, but I wouldn't be surprised if the two are fairly close. My assumption is that's why CEL is polished up and OSS (I think we first published it a few years ago, why'd it get posted now?)

Re: Common Expression Language

#15
I'd be a bit suspicious about the claim that it is not Turing complete. To be fair I can't yet find a way to allow arbitrary computation (though it seems easy to add one with fairly innocuous features). Although you can get it to solve 3-SAT, though only for some predefined number of variables (which it assures can be at least 32). Combinatorics stuff like printing all possible sudokus also seems like it should be feasible.

Don't expect your config files to terminate when they use macros, that's all I'm saying.

Re: Common Expression Language

#16
post #5

I remember seeing this used inside config files for the Caddy webserver. Google seem to like these executable config languages because they've got another open source one ("Starlark") a few notches up in expressivity.

Starlark is Python (thanks Guido!), while CEL is designed specifically to not be Turing complete or have constructs like loops, etc.

"CEL evaluates in linear time, is mutation free, and not Turing-complete. This limitation is a feature of the language design, which allows the implementation to evaluate orders of magnitude faster than equivalently sandboxed JavaScript."

As mentioned, the goals are security policies (it was first used internally as the Security Rules for Cloud Storage for Firebase and the Cloud Firestore) and proto contracts (e.g. you could define addons to your proto to specify the data matched certain behavior):

I forget the exact syntax for the contract, but it looked something like this...

``` message person { @contract(matches(/* RE2 phone number regex */)) string phone_number = 1; ... } ```

That data could enforce client side checks as well as be used server side (in different implementation languages).

I always wanted to see it combined with the proto to Firebase Security Rules generator (https://firebaseopensource.com/projects/firebaseextended/pro...) to do client and server validation.

Re: Common Expression Language

#17
post #4

At the end of the README: Disclaimer: This is not an official Google product.

I'm a Googler, opinions are my own. A lot of the times engineers at Google will open source libraries or tools they have worked on, which go under the Google GitHub repo, but are attached with that language. This is basically saying that it is owned by Google but it is not something Google is officially supporting. It may continue to get updates, it may not. I've definitely seen some libraries open sourced from Googl…

What is the significance to a user of whether Google is "officially supporting" a product or not?

Re: Common Expression Language

#18

I’m curious how this differs from Sentinel, hashicorps language for similar things. Too bad it isn’t open sourced. https://www.hashicorp.com/sentinel

The underlying language the hashicorp configuration language (HCL) is open source.

Sentinel and HCL are two different things

Re: Common Expression Language

#19

I'd be a bit suspicious about the claim that it is not Turing complete. To be fair I can't yet find a way to allow arbitrary computation (though it seems easy to add one with fairly innocuous features). Although you can get it to solve 3-SAT, though only for some predefined number of variables (which it assures can be at least 32). Combinatorics stuff like printing all possible sudokus also seems like it should be fe…

As the former PM, can confirm it's not Turing complete, and there's a reason many of those innocuous features haven't been added ;)
Post reply on HN