Indeed it is possible. I’ve sketched the corresponding implementation in this gist. Unfortunately, these aspect combinators preclude the use of Kotlin inline functions which otherwise enable efficient implementation of aspects completely on par with other JVM-based AOP solutions. However, it is possible to use both approaches as I show in my gist: define inline functions for single aspects (and, maybe, for commonly used combinations) and provide ability to combine arbitrary sets of aspects (flexible, but loosing inline).

Written by

Project Lead for the Kotlin Programming Language @JetBrains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store