In this article, I will show you how to do metaprogramming in Scala. We will implement memoization annotation that will rewrite our function by adding caching mechanism inside of it. Our tools will be Scalameta and Macro paradise plugin. But let’s start from the definition of metaprogramming.

Metaprogramming is a programming technique in which computer programs have the ability to treat programs as their data.

The most boring thing I can imagine it’s talking about abstract stuff. So let’s find a real life case! If you writing functional code, probably you will have a lot of pure functions, their output fully depends on parameters that they accept. So why we must evaluate that functions every time if we can just cache results for different parameters sets? …


Arthur Kushka

I am working on React JS based framework for VR apps at Facebook.

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