Scala Days 2026

Is metaprogramming just functional programming?

Metaprogramming is the act of treating code as data, to transform it, yielding new programs. Is that not also what functional programming is all about? Similarly, what does compile time mean, when mixed with IO, where programs are constructed and run in separate phases? Let's talk about it together.


What is metaprogramming? Definitionally it is just manipulating code as data, to produce new programs. By that logic, is map and flatMap not metaprogramming? Is is metaprogramming if you use inline? What about if you use quotes and splices?

How does compiletime vs runtime factor into this? How about with something like IO, where all you are really doing is putting together a program from smaller pieces? What does compiletime vs runtime mean there?

How about program analysis? That is metaprogramming, and not something functional programming can do as easily, right?

I do not have the definitive answer to any of these questions, but I hope we can discuss them together, and maybe come closer to some idea about how metaprogramming and functional programming are similar, but possibly still different. If you've never interacted much with metaprogramming before, I hope I can give you an introduction of sort, not on how to do it, but why.

Kathryn Frid

I am a long time enthusiast for type level and generic programming in Scala. A few years back worked on getting a decent chunk of Shapeless 2 ported to Scala 3 PR as part of my Google Summer of Code project (though sadly it is blocked by Scala 3 bugs and differences). Since then I have worked on developing perpsective, my own generic programming library for Scala 3.