Sep 22, 2020

ZEF Expression Language – Our first open source contribution

As we already mentioned, we plan to open source our core Convoworks library and make it available for other integrations. Managing an open source project is not a joke. There are whole lot things to cover expect development of some uber-cool new feature that everybody are waiting for. That’s why we decided to test-run and learn the whole process by extracting small reusable chunk as a standalone library and publish it on Github and Packagist.

ZEF Expression Language is the small improvement on Symfony Expression Language component that we developed to overcome some issues we encountered with it.

The first thing is that with it you can evaluate non existing values. Instead of throwing the exception in such case, now it will just evaluate missing value to null and evaluate the rest of expression.

The second improvement is not that much critical. It just gives you ability to use some shorthand syntax.
Instead of referencing an array items with the square brackets now you can use dot notation like in Javascript, meaning that

  • myarr[‘name’] === myarr.name

There is also shorthand when referencing object getters:

  • myobj.getName() === myobj.name
  • myobj.isValid() === myobj.valid
  • myobj.hasAny() === myobj.any

The both improvements are inspired with Java Unified Expression Language behavior.