mozilla / product-delivery

Product Delivery Project Management Standards
https://github.com/mozilla/product-delivery/blob/master/STANDARDS.md
1 stars 3 forks source link

Standardize on a Cross Platform Expression Language #6

Open mostlygeek opened 6 years ago

mostlygeek commented 6 years ago

Edited to clarify proposal.

(from comment below) Every platform we ship on has a targeting itch. The only scratch we have is inventing a new library with new semantics for each platform. That's unfortunate.

We ship on many platforms:

What should we invest in so we have a reusable library across all of these platforms?


Previous proposal (replace JEXL w/ CEL):

This proposal is to gather feedback on migrating from mozJEXL to Google's opensource Common Expression Language ... or another suitable replacement.

JEXL served normandy well on Desktop. As we move into mobile we are faced with implementing a JEXL interpreter for Android (java/kotlin) and in swift for ios.

Some points about CEL:

glasserc commented 6 years ago

I think there's a pretty high cost to switching, because old versions of Firefox still only understand JEXL, so the server will probably have to offer JEXL translations of expressions until the end of time. Given that, it seems like an alternative to JEXL would have to be a big improvement for it to be valuable to switch. Looking at CEL, I don't see a huge improvement over JEXL -- I see a marginal improvement because we don't have to maintain a library.

mythmon commented 6 years ago

From the readme for cel-go:

Want to integrate CEL?

  • See GoDoc to learn how to integrate CEL into services written in Go.
  • See the CEL C++ toolchain (under development) for information about how to integrate CEL evaluation into other environments.

Following the link to cel-cpp doesn't provide any instructions for how to integrate it into other environments, or really any documentation at all.

I read that as not being able to embed cel-go in other languages, and cel-cpp not being ready to embed in production services. I would also rather reduce the amount of C++ in our infrastructure, instead of increasing it.

It could be argued that if we're going to implement something in Rust (or Kotlin/Swift), then we should implement something more standardized than JEXL. I can see some benefit here, but I think @glasserc's comments about switching languages still stand.

pocmo commented 6 years ago

On Android we start to have some use cases where JEXL sounded like an interesting solution that we already use at Mozilla. Over the next week I wanted to have a look at how complicated it would be to port our JEXL implementation to Kotlin to use it on Android. The JS and Python implementations look not that crazy big. :)

Cross platform (C++/Go implementations currently available)

I assume there will still be some effort involved in wrapping that in a way that it's convenient to use from Java/Kotlin on Android.

mostlygeek commented 6 years ago

Every platform we ship on has a targeting itch. The only scratch we have is inventing a new library with new semantics for each platform. That's unfortunate.

I think CEL is a good candidate to solve this problem. It's core design philosophy seems to nail it:

The Common Expression Language (CEL) implements common semantics for expression evaluation, enabling different applications to more easily interoperate.

There is going to be a lot of engineering work regardless of whichever language we choose. The question is what is the right spec spec to invest in across platforms? CEL, JEXL, other?

Here are the platforms where we ship:

Some questions to evaluate CEL, JEXL, etc on those platforms:

I changed the title of this issue. I think the goal is find something we can invest in that works across platforms. Replacing JEXL is just a side effect of that. Unless of course we think JEXL is the right tool ;)

pocmo commented 6 years ago

FYI: I landed a Kotlin-based JEXL implementation in the android components repository and want to experiment a bit with it: https://github.com/mozilla-mobile/android-components/tree/master/components/lib/jexl

nanshihui commented 3 years ago

any update about el both support android and ios?